For my paper Scaling Sudoku as a Constraint Problem, I generated a repository of 434,201 Sudoku instances at five sizes between 6×6 and 36×36. I used them in constraint-programming experiments to ask which propagation scheme solves a puzzle without branching, how that changes with size, and how many clues move an instance from one hardness category to another.
I also wanted to play a few of them.
That small wish grew sideways. I now have playable versions of Sudoku, Nonogram, Queens, Zip, Loopy, Tents, Patches, Wend, and its Swedish sibling Swend, all collected on a games page.
For each game, I have included a small model written in MiniZinc, a constraint-modelling language, and picked out one part of the generator to explain. These are explanatory sketches rather than the programs that build the packs. Most of the generation and solving code uses Gecode 6.4.0, alongside separate programs for importing, rasterisation, exact cover, and pack assembly.
All nine games start from a finished solution or a source image, and then add, move, or remove information until the intended answer is unique, discarding candidates that cannot be repaired cleanly. Several of the deductions used during generation also carry over to difficulty classification and hints.
Everything that generates puzzles or checks uniqueness runs offline, so the browser only receives static puzzles and stored solutions and never runs a solver. Difficulty labels come from propagation, search, or deterministic deduction measurements; they order puzzles within a pack rather than estimating how difficult a person will find them.
I checked the MiniZinc listings with MiniZinc 2.10.0.
To keep them readable, they leave out input validation, search annotations, the outer loop that rejects a candidate when a second solution exists, and output items except where the output defines which decisions count as a puzzle solution.
Sudoku: from corpus to game

The Scaling Sudoku corpus begins with 32,000 uniquely solvable base puzzles at sizes 6×6, 9×9, 16×16, 25×25, and 36×36. The generator creates a complete grid, removes clues while preserving uniqueness, and then uses Gecode to classify the resulting puzzles.
The classification extends the setup in Helmut Simonis’s 2005 paper Sudoku as a Constraint Problem by trying an ordered family of propagation configurations.
Val, Bnd, and Dom refer to value, bounds, and domain propagation, while BS and DS add bounds or domain shaving.1
The weakest configuration that solves the board without branching becomes the puzzle’s hardness tag, or Search if none of them finishes on its own.
The basic Sudoku model is pleasantly short. Passing the box dimensions as data lets the same model handle 6×6 boards with 2×3 boxes and standard 9×9 boards with 3×3 boxes.
include "globals.mzn";
int: n;
int: box_height;
int: box_width;
set of int: N = 1..n;
set of int: Values = 1..n;
set of int: BoxTopRows = {
row | row in N where (row - 1) mod box_height = 0
};
set of int: BoxLeftColumns = {
column | column in N where (column - 1) mod box_width = 0
};
array[N, N] of 0..n: clue;
array[N, N] of var Values: board;
constraint forall (row in N) (
all_different(board[row,..])
);
constraint forall (column in N) (
all_different(board[..,column])
);
constraint forall (top in BoxTopRows, left in BoxLeftColumns) (
all_different(board[
top..top+box_height-1,
left..left+box_width-1
])
);
constraint forall (row, column in N where clue[row,column] > 0) (
board[row,column] = clue[row,column]
);
solve satisfy;
The playable pack is a reproducible, fixed-seed sample of 500 base puzzles from a pinned corpus revision, limited to 6×6 and 9×9 boards. An offline importer turns the selected puzzles and their known solutions into a static pack.
Making Sudoku look more like Sudoku
Generated puzzles do not automatically have the visual symmetry people expect from a published Sudoku. I did not want to generate a separate collection just for presentation, so I wrote an offline symmetrification pass for the selected puzzles.
The pass can make two kinds of change. It can permute rows and columns while preserving the box structure, shuffling rows within a band, columns within a stack, or entire bands and stacks. It can also fill in a missing rotational partner using the value from the known solution. Adding a clue can never introduce a second solution, though it may make the puzzle easier according to the propagation classifier.
The clue pattern starts out asymmetric.
First, columns 5 and 6 swap within the right stack.
Then the middle and lower two-row bands swap places.
The first new clue stays marked in green while its existing rotational partner pulses.
The second new clue is marked and its existing partner pulses.
The third marked clue completes the last pair.
The finished clue pattern has 180° rotational symmetry.
For each puzzle, the optimiser enumerates the distinct rotational pairings available through box-preserving layouts, ranks them by how many clues are needed for 180-degree rotational symmetry, and evaluates the best three. For each candidate layout, it first tries completing the symmetry all at once; if that changes the hardness tag, it falls back to adding partner clues one at a time and keeps only those for which Gecode reproduces the original tag. It then picks whichever result leaves the fewest asymmetric cells.
Across the 500 puzzles, this pass made 228 exactly rotationally symmetric and reduced the total number of asymmetric cells from 6,172 to 1,928.
Nonogram: back to regular

In a Nonogram, the player fills cells so that the runs in every row and column match the given clues.
This game takes me back to my early Gecode work.
In 2005, I wrote the original Gecode nonogram example using Gilles Pesant’s regular constraint.
The model describes a line with runs of lengths a, b, ..., z by the regular expression
0* 1^a 0+ 1^b 0+ ... 0+ 1^z 0*
where 1 is a filled square and 0 is an empty one.
Gecode turns the expression into a finite-state machine and constrains every row and column to follow it.
The Gecode 6.4.0 example still uses the same compact idea.
Jan Wolter later included the example in his extensive survey of Paint-by-Number solvers. I rather liked his assessment: this small demonstration model performed surprisingly well alongside much larger, specialised solvers.
The MiniZinc model builds and applies the same automata directly.
Because the run clues are stored as lists, rows and columns can have different numbers of runs without padding.
line_regexp turns each list into a regular-expression string, MiniZinc compiles it to a finite-state machine, and regular constrains the corresponding row or column.
include "globals.mzn";
enum CellStates = {Empty, Filled};
int: rows;
int: columns;
set of int: Rows = 1..rows;
set of int: Columns = 1..columns;
array[Rows] of list of int: row_runs;
array[Columns] of list of int: column_runs;
array[Rows, Columns] of var CellStates: board;
function string: line_regexp(list of int: runs) =
"Empty* " ++
join(" Empty+ ", [
"Filled{" ++ show(run) ++ "}" | run in runs
]) ++
" Empty*";
% Runs [3, 2] become
% "Empty* Filled{3} Empty+ Filled{2} Empty*"
constraint forall (row in Rows) (
regular(
board[row,..],
line_regexp(row_runs[row])
)
);
constraint forall (column in Columns) (
regular(
board[..,column],
line_regexp(column_runs[column])
)
);
solve satisfy;
A newer icon pack starts with SVGs from the pinned Heroicons 2.2.0 and Phosphor Icons 2.1.1 archives. An offline rasteriser renders each icon at high resolution, fits it to one of four board sizes, and thresholds the result into filled and empty cells.
Source iconHeroicons SVG
Rasterize and trimmagnified preview
Resize and threshold10×10 puzzle bitmap
Each source icon is assigned to a single board size so the same image cannot reappear at several resolutions. The selector rejects rasters with extreme fill ratios, too many connected components, duplicate fingerprints, or badly balanced clues, and favours silhouettes that were reviewed or retain more detail. Every accepted bitmap must satisfy its derived clues and admit no second solution in Gecode.
A deterministic replay records the initial line ambiguity and largest initial candidate set, then measures deduction rounds and unresolved cells. Combined with Gecode’s search nodes and failures, those measurements rank the valid instances within each size.
Queens: grow regions around a solution

Queens is the one-star form of Star Battle: the player places one queen in every row, column, and coloured region, with no two queens touching even diagonally. The generator starts from a valid no-touch queen permutation, grows one orthogonally connected region around each queen, and then shifts non-queen cells across region boundaries while keeping every region connected.
The small example below starts with the base solution and adds proposed region boundaries, which still admit a second solution.
Moving the cell marked M into the neighbouring region eliminates the alternative and makes the intended solution unique.
The real generator repeats that kind of move, checking connectivity each time and stopping the solver as soon as it finds two solutions.
One variable per row is enough for the puzzle model, holding the column of that row’s queen. Distinct values enforce the column rule, and indexing the region matrix at each queen position covers all coloured regions at once.
include "globals.mzn";
int: n;
set of int: N = 1..n;
enum Regions;
array[N, N] of Regions: region;
array[N] of var N: board;
% Each queen is in a different column
constraint all_different(board);
% Each queen is in a different region
constraint all_different (row in N) (
region[row, board[row]]
);
% Queens in neighbouring rows may not touch diagonally
constraint forall (row in 1..n-1) (
abs(board[row] - board[row+1]) > 1
);
solve satisfy;
Region relabellings and the eight rotations and reflections of a square board collapse to a single canonical fingerprint so disguised duplicates are filtered out.
The generator also bounds how small or large any region can be, using limits I chose after measuring published LinkedIn Queens boards.
Difficulty uses the same propagation and shaving configurations as Scaling Sudoku, falling back to Search when none solves the board without branching.
Zip: ask for a counterexample

In Zip, the player draws one path through every cell while visiting numbered clues in order and avoiding hedges.
The generator encodes that path with Gecode’s circuit: each cell has a successor, and an extra return node links the final clue back to clue 1 so disconnected subtours are ruled out, while inverse path and position views make the numbered ordering constraints explicit.
Orthogonal movement is written with row and column offsets across all four directions.
MiniZinc’s default <> turns an out-of-bounds lookup into an absent cell, which can never equal the successor, so directions outside the board drop out of the disjunction without needing a separate adjacency matrix.
include "globals.mzn";
int: rows;
int: columns;
int: cells = rows * columns;
set of int: Rows = 1..rows;
set of int: Columns = 1..columns;
set of int: Cells = 1..cells;
set of int: Nodes = 1..cells + 1;
int: return_node = cells + 1;
enum Directions = {Up, Right, Down, Left};
array[Directions] of int: row_offset = [-1, 0, 1, 0];
array[Directions] of int: column_offset = [0, 1, 0, -1];
array[Rows, Columns] of Cells: board =
array2d(Rows, Columns, [cell | cell in Cells]);
array[Cells, Cells] of bool: hedge; % Symmetric
int: number_count;
array[1..number_count] of Cells: numbered_cell;
array[Nodes] of var Nodes: successor;
array[Cells] of var Cells: path;
array[Cells] of var Cells: position;
constraint circuit(successor);
constraint inverse(path, position);
constraint successor[return_node] = numbered_cell[1];
constraint successor[numbered_cell[number_count]] = return_node;
constraint forall (
row in Rows,
column in Columns
where board[row,column] != numbered_cell[number_count]
) (
let {Cells: cell = board[row,column]} in
exists (direction in Directions) (
successor[cell] =
(board[
row + row_offset[direction],
column + column_offset[direction]
] default <>)
) /\
not hedge[cell,successor[cell]]
);
constraint path[1] = numbered_cell[1];
constraint path[cells] = numbered_cell[number_count];
constraint forall (step in 1..cells-1) (
successor[path[step]] = path[step+1]
);
constraint forall (number in 1..number_count-1) (
position[numbered_cell[number]] < position[numbered_cell[number+1]]
);
solve satisfy;
To decide which numbers and hedges to show, the Zip generator starts with only the first and last numbers, asks the solver for a second path, and uses that counterexample to pick the next clue.
The example below starts after one checkpoint has already been added, so both paths obey the visible clues 1, 2, and 3.
The added clue forces the middle-left cell to appear after the top-middle one, which holds for the intended path but rules out the counterexample. Whenever possible, the generator repeats this by adding a numbered checkpoint whose position separates the two paths, or a pair of numbers when the paths visit those cells in opposite orders. It falls back to adding a hedge only when numbers cannot eliminate the counterexample within the clue-density cap, keeping the board from filling up with annotations.
Zip uses the same nine propagation and shaving configurations as Scaling Sudoku, plus Search when none finishes without branching, and the interface maps those ten internal tags onto relative labels from Gentle to Expert.
Loopy: hide clues from a finished loop

Loopy is played on the edges of a square grid, where the aim is to draw a single closed loop without branches or crossings. A number inside a cell tells the player how many of its four edges belong to the loop, while a blank cell imposes no count.
The generator starts from the finished loop itself, growing a connected patch of cells while keeping the outside cells connected and rejecting any boundary that is not a single simple loop. Counting the loop edges around every cell then yields a fully clued board.
The MiniZinc model gives each grid vertex a successor variable.
Vertices outside the loop point to themselves, while the rest form one directed cycle enforced by subcircuit.
An undirected grid edge belongs to the loop whenever either endpoint points to the other.
include "subcircuit.mzn";
enum Cells;
enum Vertices;
enum Edges;
enum Sides = {North, East, South, West};
array[Cells] of opt 0..3: clue;
array[Cells, Sides] of Edges: cell_edge;
array[Edges] of Vertices: edge_from;
array[Edges] of Vertices: edge_to;
array[Vertices] of set of Vertices: neighbour = [
{edge_to[edge] | edge in Edges where edge_from[edge] = vertex} union
{edge_from[edge] | edge in Edges where edge_to[edge] = vertex}
| vertex in Vertices
];
array[Vertices] of var Vertices: successor;
constraint forall (vertex in Vertices) (
successor[vertex] = vertex \/
successor[vertex] in neighbour[vertex]
);
constraint subcircuit(successor);
constraint exists (vertex in Vertices) (
successor[vertex] != vertex
);
% An undirected edge cannot be traversed in both directions.
constraint forall (edge in Edges) (
not (
successor[edge_from[edge]] = edge_to[edge] /\
successor[edge_to[edge]] = edge_from[edge]
)
);
array[Edges] of var bool: in_loop = [
successor[edge_from[edge]] = edge_to[edge] \/
successor[edge_to[edge]] = edge_from[edge]
| edge in Edges
];
constraint forall (cell in Cells where occurs(clue[cell])) (
sum (side in Sides) (in_loop[cell_edge[cell, side]]) =
deopt(clue[cell])
);
solve satisfy;
% Puzzle solutions are undirected edge sets, not cycle orientations.
output [show(in_loop)];
The additional edge constraint rules out a directed two-cycle between adjacent vertices, which would otherwise collapse to a single undirected edge rather than a loop.
Because the output records only in_loop and the omitted uniqueness loop blocks each discovered edge set, the two directed orientations count as the same puzzle solution.
A fully clued board is a useful starting point, but a dull puzzle.
The generator hides clues one at a time, keeping a clue hidden only if the intended loop stays unique, and for Easy or Medium candidates the local deduction engine also checks that the board stays inside the requested band.
Difficulty comes from replaying two families of local deductions. Around cells, a satisfied clue excludes its remaining edges, while a clue that needs every undecided edge forces them into the loop. At grid vertices, two loop edges exclude the remaining incident edges; one loop edge with one undecided incident edge forces that edge in; and no loop edges with only one undecided incident edge forces that edge out. The difficulty bands record how many deduction rounds are needed, and every selected puzzle finishes under these rules without search.
Tents: move the trees against an alternative
In Tents, the player places one orthogonally adjacent tent for each tree so that no two tents touch, even diagonally, while matching the row and column counts. The generator starts from a valid set of tents, assigns each one a distinct adjacent tree, and derives the line counts, which often admit another tent set.
The useful counterexample pairs that alternative tent set with one possible matching to the trees.
When the intended answer is not unique, the generator moves one tree to another square beside its intended tent, choosing a square that stops the alternative tents from matching every tree while leaving the tent set and line counts untouched.
After each move, it recounts solutions and stops once only the intended tent set remains.
In the example below, dashed lines show one matching between trees and tents, while M marks the moved tree.
The MiniZinc sketch avoids putting a decision variable on every board cell.
Instead, each tree has one Coordinate decision record for its tent, and whole-array field projections such as tents.row let global_cardinality count the chosen rows and columns directly.
Optional lookups handle board edges, imaginary 2×2 squares enforce tent spacing, and sorted output identifies a solution by its tent set rather than by a particular tree-to-tent matching.
include "globals.mzn";
int: rows;
int: columns;
set of int: Rows = 1..rows;
set of int: Columns = 1..columns;
set of int: Cells = 1..(rows * columns);
enum Trees;
type Coordinate = record(Rows: row, Columns: column);
array[Trees] of Coordinate: trees;
array[Rows] of 0..columns: row_count;
array[Columns] of 0..rows: column_count;
array[Rows, Columns] of Cells: cell_id =
array2d(Rows, Columns, [cell | cell in Cells]);
array[Trees] of var Coordinate: tents;
array[Trees] of var Cells: tent_cells = [
cell_id[tents[tree].row, tents[tree].column]
| tree in Trees
];
% Each tree chooses an orthogonally adjacent cell that is not a tree.
constraint forall (tree in Trees) (
not (tents[tree] in trees) /\
exists (
row_offset, column_offset in -1..1
where abs(row_offset) + abs(column_offset) = 1
) (
tent_cells[tree] =
(cell_id[
trees[tree].row + row_offset,
trees[tree].column + column_offset
] default <>)
)
);
% diffn also makes the cells distinct, but the explicit all_different
% gives the tree-to-tent matching its own Hall-style propagator.
constraint all_different(tent_cells);
% Count the tent rows and columns directly.
constraint global_cardinality(
tents.row,
[row: row | row in Rows],
row_count
);
constraint global_cardinality(
tents.column,
[column: column | column in Columns],
column_count
);
% Two 2 by 2 squares overlap exactly when their anchor cells touch.
constraint diffn(
tents.row,
tents.column,
[tree: 2 | tree in Trees],
[tree: 2 | tree in Trees]
);
solve satisfy;
% Puzzle solutions are tent sets, not particular tree/tent matchings.
output [show(sort(tent_cells))];
The parameter array cell_id is just a coordinate lookup, and the adjacency constraint reuses the same default <> boundary idiom as Zip: strict equality cannot match the absent value returned outside the board, so the four offsets need no edge cases.
diffn normally keeps rectangles from overlapping.
Here each tent anchors an imaginary 2×2 square, and two such squares overlap exactly when their anchor cells coincide or touch along an edge or corner, so one global constraint replaces the eight-neighbour decomposition and already makes the tent cells distinct.
The explicit all_different is logically redundant, but it hands the one-to-one matching to a dedicated matching propagator.
The imaginary squares may hang past the board edges; without a container constraint, diffn only constrains them relative to each other.
Sorting the output is deliberate.
Because tents is indexed by tree, a single tent set can admit several tree-to-tent matchings, so blocking the sorted cell identifiers ensures the uniqueness loop counts player-visible tent sets rather than matching witnesses, just as the native generator does.
The player-facing Easy, Medium, and Hard labels come from replaying the hint engine’s deterministic deductions.
Easy puzzles rely on line-count and tent-spacing deductions, grass marks for cells without an adjacent tree, and trees with only one open spot left; Medium adds locked tree sets and one-to-one matching deductions; and Hard requires a short failed assumption, where the engine tries a tent or grass mark, propagates, and rejects it on contradiction.
Empty lines are useful clues, though too many produce striped boards with large inactive areas, so the generator caps empty rows and empty columns separately.
Patches: remove information from a tiling

Patches asks the player to divide the board into rectangles, one per coloured clue, while respecting any given area or shape.
The generator starts from a complete tiling produced by a bounded depth-first search using rectangles of area at least two, places a clue in a corner of each rectangle, and initially fills in both its area and its shape (Square, Wide, or Tall).
A fully described tiling is usually too easy, so the generator shuffles the clue fields and tries dropping individual areas or shapes. After each removal, an exact-cover solver counts rectangle tilings up to two, and the field stays hidden only when the tiling remains unique.
The model keeps one record for each clue and another for its rectangle’s placement variables.
The Boolean covers view is redundant, yet it makes the exact-cover constraint clear and propagates usefully from cells back to rectangles.
Corner placement is only a convention of the generated answer; an alternative rectangle merely has to contain its clue.
enum Shapes = {Unspecified, Square, Wide, Tall};
int: rows;
int: columns;
set of int: Rows = 1..rows;
set of int: Columns = 1..columns;
int: patch_count;
set of int: Patches = 1..patch_count;
type PatchClue = record(
Rows: row,
Columns: column,
0..rows*columns: area, % 0 means absent
Shapes: shape
);
array[Patches] of PatchClue: clue;
type PatchPlacement = record(
var Rows: top,
var Columns: left,
var 1..rows: height,
var 1..columns: width
);
array[Patches] of PatchPlacement: placement;
array[Patches, Rows, Columns] of var bool: covers;
constraint forall (patch in Patches) (
placement[patch].top + placement[patch].height - 1 <= rows /\
placement[patch].left + placement[patch].width - 1 <= columns /\
placement[patch].width * placement[patch].height >= 2
);
constraint forall (patch in Patches, row in Rows, column in Columns) (
covers[patch,row,column] <->
row >= placement[patch].top /\
row < placement[patch].top + placement[patch].height /\
column >= placement[patch].left /\
column < placement[patch].left + placement[patch].width
);
constraint forall (patch in Patches) (
covers[patch,clue[patch].row,clue[patch].column]
);
constraint forall (patch, other in Patches where patch != other) (
not covers[patch,clue[other].row,clue[other].column]
);
constraint forall (row in Rows, column in Columns) (
sum (patch in Patches) (covers[patch,row,column]) = 1
);
constraint forall (patch in Patches where clue[patch].area > 0) (
placement[patch].width * placement[patch].height = clue[patch].area
);
constraint forall (patch in Patches) (
clue[patch].shape = Unspecified \/
(clue[patch].shape = Square /\
placement[patch].width = placement[patch].height) \/
(clue[patch].shape = Wide /\
placement[patch].width > placement[patch].height) \/
(clue[patch].shape = Tall /\
placement[patch].width < placement[patch].height)
);
solve satisfy;
Patches classifies difficulty by giving each clue a domain of candidate rectangles, with three custom propagation tiers named Val, Bnd, and Dom to match the other games.
Val removes rectangles that overlap an assigned patch; Bnd adds cell coverage, restricting a clue’s domain whenever it is the only one that can still cover a cell; and Dom adds a local support check for the remaining uncovered cells.
Bounds- and domain-shaving variants complete the set, followed by Search.
Wend and Swend: fill a path cover with words

Wend and its Swedish sibling Swend ask the player to divide a letter grid into words of the given lengths, with every open cell belonging to one orthogonally connected word path. Both games share the same path and exact-cover models, differing only in their word lists.
Generation runs the puzzle backwards: it picks a symmetric block mask, traces a single path through every open cell, cuts that path into pieces of length three to ten, and fills the pieces with words.
The first MiniZinc sketch models the geometric step directly.
Open cells become nodes in an undirected grid graph, and requiring MiniZinc’s path constraint to visit every open node produces a Hamiltonian path from start to finish.
include "globals.mzn";
int: rows;
int: columns;
set of int: Rows = 1..rows;
set of int: Columns = 1..columns;
enum Cells;
array[Rows, Columns] of opt Cells: board; % <> marks a block
type Offset = record(int: row, int: column);
array[1..2] of Offset: forward = [
(row: 0, column: 1),
(row: 1, column: 0),
];
function opt Cells: neighbour(Rows: row, Columns: column, Offset: offset) =
board[
row + offset.row,
column + offset.column
] default <>;
type Edge = record(Cells: from, Cells: to);
array[int] of Edge: edge = [
(
from: deopt(board[row,column]),
to: deopt(neighbour(row, column, offset))
)
| row in Rows, column in Columns, offset in forward
where occurs(board[row,column]) /\
occurs(neighbour(row, column, offset))
];
set of int: Edges = index_set(edge);
var Cells: start;
var Cells: finish;
array[Edges] of var bool: used_edge;
constraint path(
from: edge.from,
to: edge.to,
source: start,
sink: finish,
ns: [cell: true | cell in Cells],
es: used_edge
);
% A path and its reverse are equivalent.
constraint start < finish;
solve satisfy;
The optional board values encode both cell identities and the graph boundary: a block holds <>, and default <> maps out-of-range lookups to the same absent value, so the occurs checks filter out blocks and off-board neighbours together.
Only rightward and downward offsets are needed because path treats edges as undirected.
path returns the chosen edges rather than an ordered list of cells, so walking them from start to finish recovers the sequence.
The native generator builds that sequence directly, cuts it into the target lengths, optionally reverses and reorders the pieces, and fills them with words.
The published 5×5 instance below shows those three steps.
1. Make a path
24 open cells
2. Cut into slots
3. Fill with words
Placing valid words does not yet guarantee a valid puzzle, because the same letters can spell other dictionary words that admit a second path cover. A trie finds every dictionary word traceable without reusing a cell, and the second model checks whether those candidate paths admit another exact cover where every cell is used once and the selected lengths match the clues.
set of int: OpenCells;
set of int: Lengths = 3..10;
enum Candidates;
array[Candidates] of set of OpenCells: candidate_cells;
array[Candidates] of Lengths: candidate_length;
array[Lengths] of int: required_count;
array[Candidates] of var bool: selected;
constraint forall (cell in OpenCells) (
sum (candidate in Candidates
where cell in candidate_cells[candidate]
) (selected[candidate]) = 1
);
constraint forall (length in Lengths) (
sum (candidate in Candidates
where candidate_length[candidate] = length
) (selected[candidate]) = required_count[length]
);
solve satisfy;
The Gecode checker stops after finding two covers and accepts only a unique decomposition.
Swend’s lexicon starts from SAOL 14 and keeps words supported by the Swedish Kelly list or NyLLex, together with reviewed additions, whereas Wend uses a filtered, pinned version of the English Speller Database. Both importers drop palindromes and reversal pairs because a path can be read in either direction.

Generated boards must contain turns and straight segments, use all four directions, and survive deduplication under rotations and reflections.
Within each board size, the generator ranks boards first by how many dictionary candidates can be traced and then by Gecode search nodes and failures, splitting them into thirds for Easy, Medium, and Hard.
Within each third, it favours boards with more mirrored letter pairs while keeping block-mask choices balanced.
Hints as small propagation systems
Some of the local deductions used to classify puzzles can also explain a player’s next move. Once the solution is stored, the easiest hint button would just reveal part of it, so I wanted the hint system to make a deduction whenever the current board supports one and to say plainly when it has to fall back to a reveal.
Sudoku and Queens share a small, puzzle-neutral deduction engine that knows about exact-one groups, capacity-one groups, conflicts, Hall sets,2 and failed-literal reasoning (the same assumption-propagation-failure test used by shaving). The engine tries its rules in teaching order and keeps a hint active until the player acts on it, with game-specific adapters translating those general ideas into cells and values for Sudoku, or rows, columns, regions, and attacks for Queens.
Sudoku first flags any incorrect entry, then tries naked singles, values with only one place left in a row, column, or box, and Hall sets of up to four cells. Its last deductive step is negative reasoning: assume a candidate, propagate forced placements, and reject the candidate if that hits a conflict. Only when none of those rules applies does it reveal a value from the stored solution.
Queens follows a similar teaching order, reporting attacking or incorrect queens and any cross that hides a solution square. It then marks squares attacked by placed queens, finds rows, columns, or regions with one candidate left, and applies locked sets when a group of regions is confined to the same number of rows or columns. Failed-literal reasoning handles what remains by tentatively placing a queen and propagating until two forced queens attack or a group loses its last candidate.
The first two examples below show direct deductions, with A marking squares the player can cross out; in the locked-set example, R marks the candidates that justify those eliminations.
Nonogram reuses the same line model for solving and for hints, though its hint logic stays local. After flagging any marked square that disagrees with the stored picture, it enumerates every line pattern compatible with the current marks and run clues, and forces any unknown square where all remaining patterns agree. Only when no row or column yields a deduction does it reveal a square from the stored solution.
The remaining games use narrower hint finders: Patches recomputes live rectangle domains; Tents replays its line, matching, and failed-assumption deductions; Loopy checks clue saturation, vertex degree, and premature closed subloops; Zip flags the first wrong turn or extends the known path; and Wend and Swend progressively reveal a word. Whenever no deduction applies, the hint tells the player it is revealing part of the stored solution.
Summary
Across all nine games, constraint models describe valid solutions, catch alternative answers during generation, and in several cases supply the deductions behind the hints. The generators reach uniqueness in different ways: filtering source images in Nonogram, stripping clues in Sudoku, Loopy, and Patches, repairing counterexamples in Queens, Zip, and Tents, and rejecting alternative covers in Wend and Swend.
I started with a large Sudoku corpus and wanted to play a few instances. I ended up with nine playable games (so far).
-
Shaving temporarily assigns a value and propagates to a fixpoint. If that assumption fails, the value can be removed without committing to a branch. Bounds shaving tests the current smallest and largest values of a domain; domain shaving tests every remaining value. I described the corresponding MiniZinc preprocessing modes in the LinkedIn Queens benchmarking post. ↩
-
Hall’s theorem gives the matching condition behind
all_different: any set ofkvariables must collectively have at leastkpossible values. If it has exactlyk, those values are reserved for those variables and can be removed from every other domain; fewer thankproves failure. Régin’s matching-based propagator uses the general form of this argument to establish domain consistency. Puget’s bounds propagator looks for the cheaper restricted form given by Hall intervals. ↩