{"spec_id":"sudoku-basic","library":"makie","language":"julia","code":"# anyplot.ai\n# sudoku-basic: Basic Sudoku Grid\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 90/100 | Created: 2026-06-25\n\nusing CairoMakie\nusing Colors\n\n# Theme tokens\nconst THEME       = get(ENV, \"ANYPLOT_THEME\", \"light\")\nconst PAGE_BG     = THEME == \"light\" ? colorant\"#FAF8F1\" : colorant\"#1A1A17\"\nconst ELEVATED_BG = THEME == \"light\" ? colorant\"#FFFDF6\" : colorant\"#242420\"\nconst INK         = THEME == \"light\" ? colorant\"#1A1A17\" : colorant\"#F0EFE8\"\nconst INK_SOFT    = THEME == \"light\" ? colorant\"#4A4A44\" : colorant\"#B8B7B0\"\n\n# Data — a classic partially-filled Sudoku puzzle\nconst puzzle = [\n    5 3 0 0 7 0 0 0 0;\n    6 0 0 1 9 5 0 0 0;\n    0 9 8 0 0 0 0 6 0;\n    8 0 0 0 6 0 0 0 3;\n    4 0 0 8 0 3 0 0 1;\n    7 0 0 0 2 0 0 0 6;\n    0 6 0 0 0 0 2 8 0;\n    0 0 0 4 1 9 0 0 5;\n    0 0 0 0 8 0 0 7 9\n]\n\n# Figure — square canvas (2400×2400 after px_per_unit=2)\nfig = Figure(\n    size            = (1200, 1200),\n    fontsize        = 14,\n    backgroundcolor = PAGE_BG,\n)\n\nax = Axis(\n    fig[1, 1];\n    title              = \"sudoku-basic · julia · makie · anyplot.ai\",\n    titlesize          = 20,\n    titlecolor         = INK,\n    backgroundcolor    = PAGE_BG,\n    aspect             = DataAspect(),\n    xgridvisible       = false,\n    ygridvisible       = false,\n    topspinevisible    = false,\n    rightspinevisible  = false,\n    leftspinevisible   = false,\n    bottomspinevisible = false,\n    xticksvisible      = false,\n    yticksvisible      = false,\n    xticklabelsvisible = false,\n    yticklabelsvisible = false,\n)\n\n# Elevated background for given (clue) cells — poly! highlights filled cells\nfor row in 1:9, col in 1:9\n    if puzzle[row, col] != 0\n        poly!(ax, Rect2f(col - 1, 9 - row, 1.0, 1.0); color = ELEVATED_BG, strokewidth = 0)\n    end\nend\n\n# Thin cell dividers (positions 1,2,4,5,7,8 — skip box boundaries at 0,3,6,9)\nthin_segs = vcat(\n    [Point2f(x, j) for x in [1, 2, 4, 5, 7, 8] for j in [0, 9]],\n    [Point2f(j, y) for y in [1, 2, 4, 5, 7, 8] for j in [0, 9]],\n)\nlinesegments!(ax, thin_segs; color = INK_SOFT, linewidth = 1.0)\n\n# Thick box boundaries including outer border (positions 0,3,6,9)\nthick_segs = vcat(\n    [Point2f(x, j) for x in [0, 3, 6, 9] for j in [0, 9]],\n    [Point2f(j, y) for y in [0, 3, 6, 9] for j in [0, 9]],\n)\nlinesegments!(ax, thick_segs; color = INK, linewidth = 3.5)\n\n# Numbers — row 1 at top (y center = 8.5), row 9 at bottom (y center = 0.5)\nfor row in 1:9, col in 1:9\n    val = puzzle[row, col]\n    if val != 0\n        text!(ax, string(val);\n              position = Point2f(col - 0.5, 9.5 - row),\n              fontsize = 33,\n              color    = INK,\n              align    = (:center, :center),\n        )\n    end\nend\n\nlimits!(ax, -0.15, 9.15, -0.15, 9.15)\n\n# Save\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}