Proper valid
This commit is contained in:
@ -66,6 +66,11 @@
|
||||
(map (lambda (y) (amount y x)) nums))
|
||||
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)
|
||||
(foldr
|
||||
(lambda (x ys) (if (in x xs) ys (cons x ys)))
|
||||
@ -152,7 +157,7 @@
|
||||
nil
|
||||
empties)))
|
||||
(if (eq empties nil)
|
||||
(if (valid grid)
|
||||
(if (validSudoku grid)
|
||||
grid
|
||||
(solverHelper (car grids) (cdr grids)))
|
||||
(if (eq size1 nil)
|
||||
|
||||
Reference in New Issue
Block a user