clone

fifteen puzzle games for the terminal, with daily puzzles, weekly ladders and xp, built on bubble tea

fix: enforce unique-lines rule during takuzu grid generation

Dami committed a4dbb52
generateComplete's canPlace only checked two of three Takuzu rules
(no triples, equal count) but not the unique-lines constraint. This
produced complete grids with duplicate rows/columns. generatePuzzle's
countSolutions — which does check uniqueness — then returned 0 for the
original grid, rejecting every cell removal and yielding fully-filled
puzzles with no empty cells.

canPlace now temporarily places the value and checks row/column
uniqueness whenever the placement would complete a row or column.
commit
a4dbb523bbf45a5ec96c8948519584458b5b4a0d
parent
ae51f4c6834d1aaea12035c7d2af0e510bf0ecc8
author
Dami <dami.etoile@gmail.com>
1 file changed, +40 -0
Mtakuzu/generator.go40++++++++++++++++++++++++++++++
M takuzu/generator.go +40 -0