Monday, June 11, 2007

Little Shop Of Sudoku Horrors

I've recently run across a few examples of unorthodox Sudoku solver programs which are kind of entertaining in a way, but also frightening. Here's an example using sql, and here's another example using regular expressions. I've spent just enough time looking at these solutions to be horrified. I certainly wouldn't want to have to maintain such code, and it confirms my general opinion that sql and regular expressions are appropriate for a limited range of situations and should not be used for general programming. Of course it's kind of amusing to see that it's possible to write a sudoku solver with these technologies in the same way that this is amusing.

Additional sudoku horrors: Sudoku in cobol! Shortest sudoku solvers! These are kind of cool, but also teach the lesson that writing maintainable code isn't just about making it as concise as possible!

Reference: Peter Norvig's python code. This code is certainly clean and compact (I do take issue a bit with his constraint propagation. You can have a look at my java code example for more details). In any case, much nicer than the craziness above.

2 comments:

Jeff said...

I've always wanted to try that phone booth trick with a bunch of hot (female) models and Mike Buckley's mom.

Vladimir Levin said...

It's important to have dreams! Please post a picture of Mike Buckley's mom for reference. Is she like Stacys Mom