Sudoku solver: reduction + brute force

ago xivulon at
Tue Jan 17 08:04:46 EST 2006

>  But to inflate my ego beyond the known universe, here is my solver
> (that solves the avove mentioned grid reasonably fast). I suppose the
> only difference is that is uses 3, rather than 2, rules to simplify
> before starting tree-like search.

Thanks for the nice problem and the nice post.

The issue with my code was not due to the reduction algorithms used.

In fact we used exactly the same set of rules, my Cell.solve was
equivalent to your Clean1 method and my Cell.skim was equivalent to
your Clean3 method (except that my algorithm was only doing "for (o1,
o2) in ((out1,out2),)", but it did not make any difference in most

The real problem was due to an external loop inside my
solveByBruteForce which was absolutely useless. I fixed that and now
everything seems ok. It can solve the mentioned grid in about half the

You can see my amended code in the link above.

More information about the Python-list mailing list