[ View menu ]

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:

sudokuza.exe yourpuzzle.txt

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!

4 Comments

  1. h2g2bob says:

    I did that too here (but with javascript and html) because some of the puzzles just annoyed me. Looks like the same method, only I used a bitmask rather than a struct.

    Keep up with the good work on the site!

    January 28, 2007 @ 6:58 am

  2. Ilya says:

    Your link is malfunctioning.

    January 28, 2007 @ 8:56 am

  3. roxy says:

    when i tried to unzip the file it asked me for a password……please help..

    March 24, 2007 @ 3:19 am

  4. Ilya says:

    Roxy,

    There is no password in sudokuza.zip. It is probably because of your unzip program. Try an empty password then.

    March 25, 2007 @ 5:03 pm

RSS feed Comments | TrackBack URI

Write Comment

 


 
XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>