Re:Will We Ever Run Out of Sudoku Puzzles?
by chopin on Saturday October 08, 2022 @05:09AM
(#33130898)
Search for 'minimal Sudoku' I think it's 17 given numbers and try those on your solver. I wrote a backtracking solver which tried on the fields with least possibilities first. It needed considerable time for these puzzles.
Re:Will We Ever Run Out of Sudoku Puzzles?
by CJefferson on Sunday October 09, 2022 @02:38PM
(#33144000)
This is a fun way of solving, but I think your book was fairly simple :)
A good way to find hard sudoku, and hard techniques, is "sudokuwiki.org".
No recursion, constant memory usage.
I assumed that this would not be enough. I was like "first I will code the obvious thing, then try the algorithm on examples from a book I bought, find the examples this cannot solve, and then think about further rules which could solve those examples". But as I tried it on the puzzles in the book, it solved all of them.
Which went against my intuition, as I was pretty sure I sometimes use more complicated rules when solving Sudoku by hand. But it turned out that it is somehow really simply for me to miss an opportunity.
This is of course not a proof that each uniquely solvable Sudoku can be solved by this algorithm, but I think that in practice at least 99% of them can be.
Then I tried an opposite thing, to use this solver to create puzzles. Like, create a full board, then try removing random numbers and check if the solver can solve this; stop when no number can be removed. This actually created pretty hard puzzles; harder than any example in my book.