Proper valid
This commit is contained in:
@ -66,6 +66,11 @@
|
|||||||
(map (lambda (y) (amount y x)) nums))
|
(map (lambda (y) (amount y x)) nums))
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
|
(defun validSudoku (grid)
|
||||||
|
(and (foldr (lambda (x b) (and (valid x) b)) 't grid)
|
||||||
|
(foldr (lambda (x b) (and (valid x) b)) 't (transpose grid))
|
||||||
|
(foldr (lambda (x b) (and (valid (getSubgridAsList grid x)) b)) 't (iota 9))))
|
||||||
|
|
||||||
(defun notPresentRow (xs)
|
(defun notPresentRow (xs)
|
||||||
(foldr
|
(foldr
|
||||||
(lambda (x ys) (if (in x xs) ys (cons x ys)))
|
(lambda (x ys) (if (in x xs) ys (cons x ys)))
|
||||||
@ -152,7 +157,7 @@
|
|||||||
nil
|
nil
|
||||||
empties)))
|
empties)))
|
||||||
(if (eq empties nil)
|
(if (eq empties nil)
|
||||||
(if (valid grid)
|
(if (validSudoku grid)
|
||||||
grid
|
grid
|
||||||
(solverHelper (car grids) (cdr grids)))
|
(solverHelper (car grids) (cdr grids)))
|
||||||
(if (eq size1 nil)
|
(if (eq size1 nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user