You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
subgridInjective :: Sudoku -> (Row,Column) -> Bool
subgridInjective s (r,c) = injective vs where
vs = filter (/= 0) (subGrid s (r,c))
consistent :: Sudoku -> Bool
consistent s = and $
[ rowInjective s r | r <- positions ]
++
[ colInjective s c | c <- positions ]
++
[ subgridInjective s (r,c) |
r <- [1,4,7], c <- [1,4,7]]
The call of function subgridSecondInjective is missing in consistent.
Ex. 2
The following code is Okay
constraints :: Sudoku -> [Constraint]
constraints s = sortBy length3rd
[(r,c, freeAtPos' s (r,c) totConstrnts) |
(r,c) <- openPositions s ]
I see you understand this, but you are on the half way.
Exercise 4
Good. Only unnecessary complicated code.
ex4_21 :: Int -> IO ()
ex4_21 n = ex4_22 n False 0 emptyN emptyN emptyN
ex4_22 :: Int -> Bool -> Int -> Node -> Node -> Node -> IO ()
ex4_22 _ False 1000 _ _ _ = do
print("No sudoku found")
ex4_22 n False c _ _ _ = do
print("Try")
print(show c)
print("/1000")
r <- genRandomSudoku
bs <- randomize [0..8]
let x = eraseBs r (take n bs)
temp <- genProblem x
ismin <- isMinimal temp
ex4_22 n ismin (c+1) r x temp
ex4_22 n True c r x temp = do
showNode r
showNode x
showNode temp
Exercise 5
The question was to generate NRC sudokos's without empty blocks. Thus the code can then be much simpler. But the remark is correct.
The text was updated successfully, but these errors were encountered:
The call of function
subgridSecondInjective
is missing inconsistent
.Ex. 2
The following code is Okay
but why not refactor the code
I see you understand this, but you are on the half way.
Exercise 4
Good. Only unnecessary complicated code.
Exercise 5
The question was to generate NRC sudokos's without empty blocks. Thus the code can then be much simpler. But the remark is correct.
The text was updated successfully, but these errors were encountered: