2026-05-13
How Sudoku Puzzles Are Generated (and Why Some Are Unsolvable)
Step 1: Generate a complete solution
Start with an empty 9×9 grid. Fill it cell by cell using backtracking: at each empty cell, try digits 1-9 in random order. If a digit fits the row/column/box rules, place it and recurse. If no digit fits, backtrack. After 81 successful placements, you have a valid complete grid.
Step 2: Remove cells while keeping uniqueness
Now "dig" cells out of the solution to create the puzzle. Pick a random cell, blank it, and verify the puzzle still has exactly one solution. If yes, keep it blank and dig the next cell. If removing breaks uniqueness, restore it and try a different cell.
Why uniqueness matters
A puzzle without a unique solution is unsolvable by logic alone — players would have to guess at some point. Good puzzles guarantee that every move is logically deducible from the current state. Bad generators skip the uniqueness check and ship puzzles requiring trial and error.
Difficulty by clue count
Roughly: 35-40 clues = Easy, 30-34 = Medium, 25-29 = Hard, 20-24 = Expert. The minimum number of clues that can still yield a unique solution is 17 (proven via exhaustive search in 2012). Don't try this at home.
Why daily puzzles repeat across sites
If two sites use the same deterministic seed (e.g. date-based), they generate the same puzzle. This is fine — Sudoku has more than 6 × 10^21 valid grids, so collision risk is essentially zero.