Everyone assumes the hard part of a puzzle generator is the solving algorithm. It is not. The hard part is proving that the puzzle you generated has exactly one solution - and that gets dramatically harder once you add a second rule family on top of the standard one.
I have been building a variant called Queens and Star, which layers two extra constraints onto a grid: region markers and a small set of starred cells that must obey their own counting rule. Here is what that taught me about generator design.
Rule check first, solver second
The temptation is to write a solver and let it treat the extra rules as optional decorations. That fails fast, because a solver that ignores a rule will happily certify a grid as valid when it is not.
The order that works:
- Write an incremental rule checker that validates each placement against every rule family at once.
- Make the solver call that checker and nothing else, so there is exactly one definition of valid.
- Count solutions with a hard stop at two. You never need to know if there are a thousand.
The two-solution stop is the single biggest performance win in this kind of project. Proving uniqueness is a boolean question, not a counting question.
Uniqueness on a variant grid
On a standard 9x9, removing clues one at a time and re-running the solver is the usual approach. With a second rule family the search space changes shape: some clue removals are blocked only by the new rule, and some cells become redundant in a way that no standard solver would notice.
Practical consequences:
- Removal order matters. Random removal produces wildly different difficulty profiles from the same seed.
- You need a cached solution per candidate grid, or you will re-solve the same board dozens of times.
- A grid that passes uniqueness can still be uninteresting; uniqueness is a floor, not a difficulty target.
Difficulty is a distribution, not a number
The honest way to calibrate is to measure what solving techniques are required, not how long a human takes. If a puzzle can be finished with singles only, it is easy regardless of how many clues it has. If it needs a chain of deductions, it is not.
So the generator should tag each puzzle with the technique set its solution requires, then bucket those. That gives you a real difficulty axis and a reproducible one.
What this looks like in practice
The version I keep at https://meowdokugame.app/ runs the rule-check-first approach: every board is validated against both rule families before it is shown, and solution counting stops at two. It is also the cheapest test bed I have for the generator, because a broken rule check shows up as an instantly-solved board.
The takeaway
Variants are not standard puzzles with extra spice. The second rule family changes the search space, the uniqueness proof and the difficulty model. Build the checker first, count to two, and measure techniques instead of time - those three decisions carry the whole project