Proper valid

This commit is contained in:
2025-10-15 11:13:47 +02:00
parent d694adfb95
commit b5321a6f8e

View File

@ -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)