Sudoku
All formats · Reader spec · Cases and output
sudoku.iris reads a # size=N box=WxH header followed by
an N×N grid. The alphabet 123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0 maps to
values 1–36; . maps to 0 for blank cells. Data contains n,
box_width, box_height, and cells. Checks require the box area to
equal N and every given value to be at most N; solving the puzzle and
checking its uniqueness belong to the host.
The format source is the scaled sudoku corpus README. The reader spec is copied verbatim from Gecode’s sudoku-instances.hh.
- four-by-four uses a 4×4 grid with 2×2 boxes and blank cells.
- bad-box-size changes the box dimensions to
3×2. The reference reports
E-CHECK-FAILEDwith an empty record path.
The instances statement permits several puzzles in one file; these
samples each contain one. These are hand-made samples under the
repository’s MIT license. See the library README for case
layout, validation, and Gecode notices.
Reader spec
From Gecode commit 5e7bbd5c26b0702c6fd652356b2289da0710ac3c. Source notices.
Cases and output
Run the commands from the repository root. Successful reads show dzn, JSON, and a summary. Rejected inputs show the CLI's diagnostic and caret, with the stable error code beside it.
bad-box-size
Box dimensions do not tile the grid
E-CHECK-FAILED
check failed: boxes must tile the grid
iris read formats/sudoku/sudoku.iris formats/sudoku/cases/bad-box-size/input.txt --dznformats/sudoku/cases/bad-box-size/input.txt:5:5: check failed: boxes must tile the grid
5 | 4..1
| ^
while reading: instance [1]
spec: formats/sudoku/sudoku.iris:7
Input rejected
four-by-four
Four-by-four grid with two-by-two boxes
dzn
iris read formats/sudoku/sudoku.iris formats/sudoku/cases/four-by-four/input.txt --dznJSON
iris read formats/sudoku/sudoku.iris formats/sudoku/cases/four-by-four/input.txt --jsonSummary
iris read formats/sudoku/sudoku.iris formats/sudoku/cases/four-by-four/input.txt --summary