Writing a Procedural Puzzle Generator
Instead my solver doesn’t actually make one move at a time, but solves the puzzle by layers: given a state, find all valid moves that could be made. Let’s start with a puzzle that’s probably unsolvable, consisting just of numbers 2-5 placed in random locations on the grid:
The solver runs until it can’t make any more progress:
The generator then adds some information to the puzzle, in the form of a dot, and continues solving. So the generator will keep on adding more dots until the solver is happy:
And then the solver resumes normal operation:
This process continues either until the puzzle is solved or there is no more information to add (i.e. every space that’s reachable from a number is covered by a dot).
Source: www.snellman.net