From: levy
Subject: Sudoku solver
Date: 
Message-ID: <eafe6dfb-9046-4f0e-bc7a-6fc50b97bb66@i7g2000prf.googlegroups.com>
I had some spare time at the weekend and wrote a sudoku solver based
on the computed-class library.

The idea is to have the 81 solution elements connected in a way that
expresses the constraints between them and let computed-class do the
rest. A constraint for an element is that it cannot have a value equal
to the selected value of any other element in the same row, column or
block. Well, this is actually the game's rule...

The solver goes recursively and at each step it selects a value from
the set of possible values for the element which has the least
possible values without actually having a selected one. If it fails to
do so then it returns to the previous level in the recursion to select
another one.

The point is that the code is quite short while it is still
suprisingly efficient and easy to understand, at least I think...

http://common-lisp.net/project/computed-class/sudoku-source.html
http://common-lisp.net/project/computed-class/sudoku-repl.html

levy