All your Sudoku puzzles are belong to us
Today I’ve found Sudokuza while revising my archives. This is a program that 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 which would solve a puzzle the similar way as a human would do, without hardcore math.
The algorithm is very simply and straightforward. Sudokuza eliminates each 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 and a puzzle is not solved then it takes one of the remaining variants from the first unsolved cell as a correct answer and try to continue. And so on, until puzzle is done or given up. Sudokuza give up on a cell with zero variants left or an impossibly solved number.
Sudokuza was written in C and here is its source code – sudokuza.c. There is also a ZIP archive (34kb) which includes this code, compiled executable and few sample puzzles.
Since Sudokuza was written primarily for personal entertainment, it is not that user-friendly. It is a command-line utility that input a puzzle from a specified text file:
The file format is simple – first nine characters from first nine lines form a Sudoku grid. Take a look inside ZIP archive for samples, these are easy to understand.
Have fun :)
Reddit this / Add to del.icio.us / Digg this!
Subscribe to RSS feed