Programming: Interactive Sudoku Solver

This afternoon, I was taken by a desire to build an automatic solver for Sudoku. Jotting down some notes, I quickly wrote this program. So what does it do and how do you use it? Well...

Firstly, it isn't a complete automatic Sudoku solver. I think I'm at the stage where I need to write a guess and check algorithm, but I might think of another solution. Anyway, what it does do is remove all the trivial steps from the process of solving the puzzle. Consider the Sudoku below (on the left):

This puzzle has plenty of easy values to enter. These are one and two step thoughts. There is nothing particularly deep about filling in the six in row seven, column five. This program will automatically fill in these values until you are left with a puzzle like the one below (also on the left):

Even though there are 20 less values to enter, this is the more interesting part of the puzzle. You need to think through several steps now before you can put down an answer. The program is interactive so you can enter your guess directly.

To use the program, download the jar file. Then from a console (command prompt), type "java -jar SudokuSolver.jar" to run the program. It will start from a blank Sudoku so you'll have to enter the values to build any particular one. There is support for reading a file, but it's formatted identically to the interactive mode so it isn't much help at the moment (to use, save a file of space delimited row/col/val triplets, and run "java -jar SudokuSolver.jar xyv filename").

The program source is included in the jar (in the net/aronnax/SudokuSolver subfolder).

AttachmentSize
SudokuSolver.jar9.69 KB