On Wednesday, 15 August 2012 at 20:28:19 UTC, Jonathan M Davis
wrote:
Brute force is so fast that there's no really any point in
trying to solve it any other way except for the challenge of
doing so. I answered a question on this using D at
codegolf.stackexchange.com a while back:
http://codegolf.stackexchange.com/questions/378/implement-a-brute-force-sudoku-solver/402#402
and the code is lightning fast. It would probably have to be
tweaked to match whatever Bearophile's code does though as far
is input goes (I haven't looked at the code that he linked to).
It also makes no attempt at being compact (e.g. it actually
checks the command line arguments). It's at just over 150 lines
and could be much shorter if I really tried to properly golf it
rather than just solve the problem.
Interesting... Against the same input that brute force only one
succeeded in 2 seconds vs my 9-12. And on the puzzle supplied on
the Page, about 250ms compared to mine at 400ms.
If I add a few lines to remove the only real bottle-neck (cache
result of 4 functions) I'm sure mine would easily out-perform
that one; But I wasn't going for absolute speed and keeping
things simpler.