All your Sudoku puzzles are belong to us
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 goal was to create a program that would solve a puzzle the similar way as a human would do, without a hardcore math.
The algorithm is very simple and straightforward. Sudokuza eliminates a solved number from the variants for remaining cells within the corresponding row, column, and 3×3 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 puzzle is solved or given up. Sudokuza gives up on a cell with zero variants left or an impossibly solved number.
Sudokuza is written in C and here is its source code – sudokuza.c. There is also a ZIP archive (34kb) with source code, compiled executable and few sample puzzles.
Since I wrote Sudokuza primarily for personal entertainment, it is not that user-friendly. It is a command-line utility, which inputs a puzzle from a specified text file:
The 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 :)
Reddit this / Add to del.icio.us / Digg this!
Subscribe to RSS feed