[funds-cvs] r213 - trunk/funds/examples

abaine at common-lisp.net abaine at common-lisp.net
Tue Aug 21 17:30:42 UTC 2007


Author: abaine
Date: Tue Aug 21 13:30:41 2007
New Revision: 213

Modified:
   trunk/funds/examples/sudoku.lisp
Log:
Eliminated un-needed functions from solver.

Modified: trunk/funds/examples/sudoku.lisp
==============================================================================
--- trunk/funds/examples/sudoku.lisp	(original)
+++ trunk/funds/examples/sudoku.lisp	Tue Aug 21 13:30:41 2007
@@ -46,15 +46,10 @@
      (round (expt (puzzle-size puzzle) 3))))
 
 (defun puzzle-solved-p (puzzle)
-  (= (round (expt (puzzle-size puzzle) 2)) 
-     (tree-count +true+ (puzzle-tree puzzle) :key #'bt-value :test #'=)))
-
-(defun puzzle-solvable-p (puzzle)
   (let ((size (puzzle-size puzzle)))
-    (iter (for f in x-y-z-functions)
-	  (always (iter (for x below size)
-			(always (iter (for y below size)
-				      (always (group-solvable puzzle f x y)))))))))
+    (= (round (expt size 2))
+       (tree-count +true+ (puzzle-tree
+			   puzzle) :key #'bt-value :test #'=))))
 
 (defun fill-true (puzzle i j k)
   (fill-falses (set-to-true puzzle i j k) i j k))
@@ -190,21 +185,6 @@
 	       (mod x order))
 	    k)))
 
-(defun group-solved (puzzle x-y-z-function x y)
-  (let ((size (puzzle-size puzzle)))
-    (= 1 (iter (for z below size)
-	       (count (elt-true-p (multiple-value-call
-				      #'puzzle-elt puzzle
-				      (funcall x-y-z-function x y z size))))))))
-
-(defun group-solvable (puzzle x-y-z-function x y)
-  (let ((size (puzzle-size puzzle)))
-    (iter (for z below size)
-	  (for elt = (multiple-value-call #'puzzle-elt
-		       puzzle (funcall x-y-z-function x y z size)))
-	  (thereis (or (elt-unknown-p elt)
-		       (elt-true-p elt))))))
-
 (defvar x-y-z-functions (list #'i-j-k-coordinates
 			      #'i-k-j-coordinates
 			      #'j-k-i-coordinates



More information about the Funds-cvs mailing list