They recently put Sudoku puzzles in the dutch newspaper 'De Telegraaf' where it piqued my interest. Solved a couple by hand and figured this was just _begging_ for a computerised solver.
After having my dad claim it was impossible (heh), I had all the incentive to get to work.
The end result is here:
http://www.wirschell.nl/sdk.cIt's a bit crude because it has the input puzzle hardcoded. I'll work on that a bit.
What seems to differentiate my solver from the ones discussed in this thread is that mine isn't recursive, and doesn't brute-force. Instead, it uses the puzzle's logic to solve the thing.
Oh, and like the other solvers discussed here, it's mindnumbingly fast. I made the program repeat the same puzzle 1000 times and used the UNIX 'time' program to see how fast it was. Result: real 0m0.294s
300ms for 1000 (!!) puzzles on an Athlon XP 2200+.
The solver needed 3 iterations to complete the puzzle, where one iteration means
- Fill in fields that can only have 1 value.
- Fill in row fields that can only have 1 value in the context of the row.
- Fill in column fields that can only have 1 value in the context of the column.
- Fill in block fields that can only have 1 value in the context of the block.
The puzzle used was the one on the screen shot
here.
Since my solver doesn't guess, the difficult puzzle Tom posted which his program solved in 36 ms cannot be solved by my program. I don't blame it, though, because I can't see how any human could solve that one, and in fact I wonder if that puzzle really has only 1 solution (think you could test that for me?).
Kind regards,
Tom Wirschell