

Solving Sudoku with TDD - gcv
http://www.infoq.com/news/2007/05/tdd-sudoku

======
jcl
I ran across the Ravi Mohan post last year that compares Jeffries' and
Norvig's approaches to solving Sudoku. Upon reading the actual articles, I
felt that the comments in that thread were somewhat unfair.

Jeffries explicitly states that he is unfamiliar with Sudoku and rusty with
Ruby, so of course he is going to make mistakes as he seeks a solution; it
doesn't help his perceived credibility that he makes lots of little mistakes
and documents his fixes for each one. His Test-Driven Design approach makes
for a long and boring read, but it is what enabled him to make as much
progress as he did.

Norvig, on the other hand, has a masterful command of Python and has probably
worked through dozens of Sudoku by hand, never mind that he is intimately
familiar with constraint propagation and doesn't bother describing any
problems he had typing up the program.

To Jeffries' credit, he seems to hit upon the same solution as Norvig in the
very first article (a "tree-trimming" solution, as he puts it), but he doesn't
get around to implementing it. He states that he doesn't think it will run
fast enough for all puzzles -- a perfectly reasonable concern that Norvig
ducks entirely by running his solution on a hundred puzzles and timing them,
then assuming they constitute the hardest puzzles the algorithm will
encounter, in the astronomical space of all puzzles. It's not an unreasonable
assumption, but it is an assumption nonetheless; there could well be a Sudoku
puzzle out there that causes Norvig's algorithm to run an unreasonably long
time.

