Target and Sudoku

Thu, 05 Jul 2007

There is a game called target in my newspaper where you are given 9 letters and have to find anagrams of some length with one particular letter included. I wanted to beat some people at it, so I wrote a target solver. It works the obvious brute force way (use as ./target.rb ninelettr).

There is another game called Sudoku, which I don't think goes by any other names so it shouldn't need an intoduction, and I wanted to beat some people at it too, so I wrote a sudoku solver. It works by picking a blank square and assuming it is 1, then trying to solve the rest of the puzzle. If it finds a solution, then we win, if it doesn't, then it assumes that the current blank square is a 2 and tries to solve the rest. Repeat and recurse. (Use as ./sudoku.rb puzzle where puzzle is a text file containing 9 lines, each with 9 numbers. Use '0' for blanks. Output isn't pretty.)

For my purposes, I only needed to do 4 target questions and 3 sudoku puzzles, so this is reflected in the quality of the code.

Both programs get a BSD license just for a change.

Name & email are optional. Email will not be obfuscated.
HTML tags will be removed except hyperlinks.
 

About

I'm a nerd living in Sydney. This is a place where I can write stuff about my interests and not care that no one else is reading.

I like music, maths, programming, pretty pictures, filters and other good things.

(more info)

It should be fairly obvious that this isn't connected to my employer at all.

Email me (not a catchpa)

Email policy

Subscribe

RSS Feed RSS

Get an aggregator

Liferea (Linux)

Vienna (OSX)

Feedreader (Windows)

Google Reader (Web based)

I've only used Liferea, so I can't vouch for the other ones.

About this site

This site runs a (modified) version of blosxom.

The host is GeekISP, and they seem to do an excellent job.