Hello, sudoku generator, need help

Started by
9 comments, last by Nyarlath 15 years, 6 months ago
Quote:Original post by Answer3
I run it on empty board and it gave me only one solution.


It gives you the first solution it founds (the first line is probably 123456789 and the second is 456123789 and so on, if no randomness is involved).

That's fine for the moment, keep this filled board as starting point.

Now you need to be able to detect that/if there is more than one solution. You just shouldn't stop your algorithm when it founds a solution; if you find one, remember it and continue with your back-tracking algorithm until all possible values of every cell are tried. If you find a second solution, stop the algorithm and return the solution previously found and a boolean indicating that there are other solution.

Now you can implement the second step of the algorithm of my first post!

This topic is closed to new replies.

Advertisement