AI Portfolio Lab Tools Games Blog Feedback
All Posts

My Sudoku Solver Gave Me an Answer. It Was Wrong.

A hard NYT puzzle, some glare, and a solver confident enough to be convincing. The problem wasn't the solving. It was what I hadn't read.

1 min read
toolssudokudebugging

I assumed solving proved reading. If the Sudoku Solver found an answer, the scan was correct. Detection is the part that can fail. Solving is just math. If the math runs clean, the read was clean.

That held until I pointed the camera at a hard NYT puzzle in bad lighting.

The NYT runs hard puzzles at around 23 clues. Glare washed some of them out. OCR read those cells as empty, so the solver saw a board with fewer real constraints than the printed puzzle had. A sudoku with missing clues is under-constrained. Many valid solutions exist. The solver found one.

The result looked right. Blue numbers over every empty cell, clean grid, no warnings. A confident answer.

The answer was to a different puzzle than the one on the paper.

That’s what makes this version of wrong hard to catch. There’s nothing to flag. The output is valid against every check the solver has, consistent with everything the camera saw, including the cells it misread as empty.

The fix is a uniqueness check. A real published sudoku has exactly one solution. A board missing clues has many. So the solver now counts past the first solution it finds. If it finds a second, the board is ambiguous. Auto-scan stays live and shows “clues missed, try better lighting.” Nothing ships until there’s only one answer.

8 milliseconds for a full read. 29ms for an under-constrained board before the counter caps.

Valid isn’t proof. Unique is.