Brute force sudoku cracker

Pierre Barbier de Reuille pierre.barbier at
Sat Sep 17 15:29:18 CEST 2005

Tom Anderson a écrit :
> On Fri, 16 Sep 2005, Bas wrote:
>> -any ideas how to easily incorporate advanced solving strategies?
>> solve(problem1) and solve(problem2) give solutions, but
>> solve(problem3) gets stuck...
> the only way to solve arbitrary sudoku problems is to guess.

Well, that's true, but most of the sudoku puzzles can be solved in
linear time ! And also having a linear time solving algorithm allows you
to really reduce the time used when you need backtracking.

BTW, the three given examples can be solved without backtracking.

I made one very recently (mmhh ... first complete version made
yesterday, still need a little bit of debug on the backtracking part),
and it's pretty quick (made in Ruby but well, I suppose timing are
similar), it never get stuck for long even if it fails, it fails quickly ...


More information about the Python-list mailing list