Dec 12, 2005 14:58
I feel like my brain is starting to switch back on. This weekend I went over to a friend's house to watch a movie, and we ended up writing code until far too late at night. What, you don't always bring your laptop over to your friend's place?
We started on a couple of abstract math problems, and that morphed into the popular puzzle of "Sudoku". If you haven't seen this one, try Google, it's everywhere. A simple logic puzzle that pretends to be mathematical, but is really symbolic manipulation within a system of simple, fixed constraints.
After a thorough analysis (thorough meaning "until we were bored"), we came to the conclusion that while you can buy books of these things, and they are everywhere, there really aren't a lot of "unique" puzzles, and for each puzzle there are many mappings that make it look like other puzzles. So, most of the time, if you do these puzzles, you're solving the same logic puzzle. The symbols are just in different, and they've been rotated in 4-space. This led us to determining a 4-dimensional representation of the game, which should be useful for solving it.
Which, of course, we had to prove. His solution, in Perl, was done in about 3 hours, and solved the 9x9 puzzle in .3 seconds. I decided to use Objective-C, and took an extra hour, and solved it in .1 seconds. Given the OS, CPU, and language differences, this proves absolutely nothing except that solving a Sudoku, is not a hard problem to code.
The real positive was that, since my recent heart surgery, and a bit before, I really haven't felt like I had the brain-power to concentrate on much of any problem for long. Now, I've spent a few hours and written a pretty nice recursive decent solver with very nice pruning characteristics. So, at least to some degree, I think I'm getting more mental energy back. And that is definitely a good thing.