Perl Sudoku Solver
For building and installation instructions please see the INSTALL file.
sudoku is a perl script which solves soduku grid of square size :
4x4 9x9 16x16 25x25...
For more documentation about available options, see the manpage below.
sudoku is free software.
Please see the GNU public
licence for details
sudoku - solve sudoku grid
sudoku [options] [GRID]
Solve sudoku grid. The grid must have format 4x4 9x9 16x16 25x25...
Solving higher grid should take long time.
The algorithms used to solve grid are really basic.
First, for each number it look if the number can be placed in line/col-
umn/bloc. e.g.: if there is no "2" in the first line, it looks in which
case a "2" can be placed. For that, it look in all columns and in the
blocs crossing the first line if there are some "2". If only a case in
the first line can contain a "2", it place it here. This algorithm is
applied as long as it place at least a number. The max cost is ridicu-
lous (leaser than n^3 where n is the size of the grid).
Secondly, a brut force recursive algorithm is used. It starts a line 1,
column 1 and for each empty case, look what numbers can be placed here.
It places one and go to the next empty case. If no number can be put in
the case, it's a dead end : it up to the previous filled case and try
another number. The cost for this algorithm is really big.
Two formats can be used : letter ([a-z]) or numbers. The elements can
be attached or separated by "," or "|". The numbers greater than 9
must be given separed. The empty case can be : " " "." "_" "0" for
number and " " "." "_" "`" "@" for letters. An empty string can be used
e.g.: sudoku 1000 0210 0030 0104
sudoku "a " " ba " " c " "a d"
sudoku A,,, ,B,A, ,,C, ,A,,D
NB: the format must be the same for all lines
Search all solutions. The default is to stop when the first
solution is find. A good sudoku grid should have only one
Display what the algorithm is doing.
-f, --file FILE
Read the grid from file. The format is a line of the grid per
line. For compatibility, if the first line contains the size
of the grid, it is ignored.
Display somes informations about the resolutions.
GNU STANDARD OPTIONS
--help Print a usage message on standard output and exit success-
Print version information on standard output, then exit suc-
-- Terminate option list.
Print the manual page and exit.
Stephane Levant <firstname.lastname@example.org>
0.1 2006-03-15 SUDOKU(1)