Author: abaine Date: Sat Aug 18 19:15:57 2007 New Revision: 142
Modified: trunk/funds/src/examples/sudoku.lisp Log: Box-number.
Modified: trunk/funds/src/examples/sudoku.lisp ============================================================================== --- trunk/funds/src/examples/sudoku.lisp (original) +++ trunk/funds/src/examples/sudoku.lisp Sat Aug 18 19:15:57 2007 @@ -82,6 +82,21 @@ (1+ x))))) (f puzzle 0))))
+(defun box-number (puzzle i j) + (let ((order (order (puzzle-size puzzle)))) + (+ (* order (floor i order)) + (floor j order)))) + +(defun fill-falses-group-2 (puzzle x-y-z-function x y) + (let ((size (puzzle-size puzzle))) + (labels ((f (puzzle z) + (if (= z size) + puzzle + (f (multiple-value-call #'set-to-false + puzzle (funcall x-y-z-function x y z size)) + (1+ z))))) + (f puzzle 0)))) + (defun box-coordinates (i j k x size) (let ((order (order size))) (values (+ (* order (floor i order)) @@ -296,4 +311,3 @@ (count (elt-true-p (multiple-value-call #'puzzle-elt puzzle (funcall x-y-z-function x y z size)))))))) -