[funds-cvs] r149 - trunk/funds/src/examples
abaine at common-lisp.net
abaine at common-lisp.net
Sun Aug 19 15:07:42 UTC 2007
Author: abaine
Date: Sun Aug 19 11:07:40 2007
New Revision: 149
Modified:
trunk/funds/src/examples/sudoku.lisp
Log:
Renamed solve do puzzle-solve and added (solve list).
Modified: trunk/funds/src/examples/sudoku.lisp
==============================================================================
--- trunk/funds/src/examples/sudoku.lisp (original)
+++ trunk/funds/src/examples/sudoku.lisp Sun Aug 19 11:07:40 2007
@@ -4,6 +4,9 @@
(defconstant +false+ 0)
(defconstant +true+ 1)
+(defun solve (list)
+ (list-from-puzzle (puzzle-solve (puzzle-from-list list))))
+
(defstruct puzzle
size
tree)
@@ -125,7 +128,7 @@
(collect (or (puzzle-elt puzzle i j k)
"")))))))))
-(defun solve (puzzle)
+(defun puzzle-solve (puzzle)
(if (puzzle-solvable-p puzzle)
(if (puzzle-complete-p puzzle)
puzzle
@@ -174,7 +177,7 @@
(funcall x-y-z-function x y z size)
(if (puzzle-elt puzzle i j k)
(f (1+ z))
- (or (solve (fill-true puzzle i j k))
+ (or (puzzle-solve (fill-true puzzle i j k))
(f (1+ z))))))))
(f 0))))
More information about the Funds-cvs
mailing list