Ilya O. Levin
My Mail Box 887644, Singapore, 917644
eli@literatecode.com
Jan 23, 2007

Sudokuza

Today I have found Sudokuza while revising my archives. This program solves Sudoku puzzles. I sketched it more than a year ago for fun to avoid Sudoku mania :) My main interest in making Sudokuza was to create a program that would solve a puzzle the similar way as a human would do, without hardcore Math.

The algorithm is very simple and straightforward.

Sudokuza eliminates solved number from the variants for remaining cells within a corresponding row, a column, and a 3x3 block. All cells with a single variant left assumed as solved. If Sudokuza cannot eliminate anything then it takes one of the remaining variants from the first unsolved cell as a correct answer and tries to continue. And so on, until it solve the puzzle or give up. Sudokuza gives up on a cell with zero variants left or an impossibly solved number.

Sudokuza is written in C. Here is the source code: sudokuza.c. There is also a ZIP archive (34kb) with source code, compiled Windows executable and few sample puzzles.

I wrote Sudokuza primarily for personal entertainment, so it is not that user-friendly. It is a command-line utility, which inputs a puzzle from a specified text file:

sudokuza.exe yourpuzzle.txt

The puzzle file format is simple: first nine characters from the first nine lines forms a Sudoku grid. Look inside the ZIP archive for samples, these are easy to understand.

Have fun :)

© 2003 – 2012  Literatecode