I’ve been enjoying this site recently called The Daily WTF. It generally focuses on strange pieces of code found by developers. However, today’s post has a few funny photos. (If you are a geek, like me, that is.)
I wrote about my Sudoku solver to an acquaintance of mine. He responded, “umm, I don’t understand perl!!!”
For fun, here is a Visual Basic .NET version of the Sudoku solver. It’s probably not idiomatic as it is a straight port of the Perl version. On the flip side, it does allow me to distribute a binary version of the Sudoku solver. (.NET runtime required.) It’s not a great user interface, but it seems to work in a good enough manner for now.
I also uploaded two puzzle files for folks too lazy to type them in. The first puzzle requires a guess. The second puzzle requires many guesses (it is all blank).
Enjoy!
Weird Al is awesome.
This past week, I wrote a perl script to solve sudoku puzzles. The approach I took essentially works by brute force, but it works and the puzzle size is small. I might try to think of a better way to solve the puzzle. I intentionally did not look at other solutions so I could write my own.
The way you run the script is to type in something like perl -w sudoku.pl < puzzle
where puzzle is the name of the file containing the puzzle. It should have 81 numbers from 0-9; 0 represents blank spaces. So this:% cat puzzle2
0 6 0 0 5 0 0 2 0
0 0 0 3 0 0 0 9 0
7 0 0 6 0 0 0 1 0
0 0 6 0 3 0 4 0 0
0 0 4 0 7 0 1 0 0
0 0 5 0 9 0 8 0 0
0 4 0 0 0 1 0 0 6
0 3 0 0 0 8 0 0 0
0 2 0 0 4 0 0 5 0
gets turned into this:% perl -w sudoku.pl < puzzle2
8 6 1 4 5 9 7 2 3
4 5 2 3 1 7 6 9 8
7 9 3 6 8 2 5 1 4
2 1 6 8 3 5 4 7 9
9 8 4 2 7 6 1 3 5
3 7 5 1 9 4 8 6 2
5 4 7 9 2 1 3 8 6
1 3 9 5 6 8 2 4 7
6 2 8 7 4 3 9 5 1
If there is more than one solution, only one solution is displayed. If there is no solution, you see an error message.
The Perl Sudoku solver can be downloaded from my site. Rename the file to sudoku.pl after downloading.
My Favorite Net Things
I’ve been enjoying a webcomic; it’s very geeky. Here are some of my favorite posts so far: Alice and Bob, Donald Knuth, and Dreams. Make sure you read the alt text or title of each image, too.
At The Straight Dope, Cecil Adams writes about the different sorts of batteries. Really good information, especially if you are a photographer or a laptop user.
I’m going to see Violet Fire, an opera about Nikola Tesla at BAM, tomorrow. My friend Kristen is an understudy. After purchasing a ticket, the confirmation page displayed the following: “We are currently unable to deliver email receipts.” I’m not generally a critic of commerce web sites since they are actually really difficult to implement. But this is fairly lame. The BAM web site requires your email address–in fact, that is how you log in. It is really, really easy to send simple email. I have no idea why they cannot send an email receipt.
Sarah and Jeremy got married this past weekend!
Before the wedding:
After the wedding:
For the record, Jeremy was more relaxed than he looks in the photos. And Sarah was more serious than she looks in the photos. :-)
They got married at this great location on 36th Street. The roof was really cool.