This commit is contained in:
Leon Vatthauer 2024-06-16 15:35:14 +02:00
parent b7cb4c9cd7
commit a9eb279049
Signed by: leonv
SSH key fingerprint: SHA256:G4+ddwoZmhLPRB1agvXzZMXIzkVJ36dUYZXf5NxT+u8
2 changed files with 2 additions and 16 deletions

View file

@ -23,19 +23,6 @@ main = do
print $ isValidGrid dummyGrid print $ isValidGrid dummyGrid
putStr . printGrid . fromJust $ solve dummyGrid putStr . printGrid . fromJust $ solve dummyGrid
-- print $ colView dummyGrid 4
-- print $ squareView dummyGrid 4
-- print $ squareToCoords dummyGrid 0
-- print $ squareToCoords dummyGrid 1
-- print $ squareToCoords dummyGrid 2
-- print $ squareToCoords dummyGrid 3
-- print $ squareToCoords dummyGrid 4
-- print $ squareToCoords dummyGrid 5
-- print $ squareToCoords dummyGrid 6
-- print $ squareToCoords dummyGrid 7
-- print $ squareToCoords dummyGrid 8
-- print $ allCells dummyGrid (>= 0)
test :: String test :: String
test = "070000043040009610800634900094052000358460020000800530080070091902100005007040802" test = "070000043040009610800634900094052000358460020000800530080070091902100005007040802"
@ -74,7 +61,7 @@ isFull :: Grid (Maybe Int) -> Bool
isFull gr = allCells gr isJust isFull gr = allCells gr isJust
isSolved :: Grid (Maybe Int) -> Bool isSolved :: Grid (Maybe Int) -> Bool
isSolved gr@(Grid g d) = isValidGrid gr && isFull gr isSolved gr = isValidGrid gr && isFull gr
extractSolution :: Grid (Maybe Int) -> Grid Int extractSolution :: Grid (Maybe Int) -> Grid Int
extractSolution gr = extractSolution gr =

View file

@ -1,8 +1,7 @@
module Types where module Types where
import Data.List (intercalate) import Data.List (intercalate)
import Data.List.Split (chunksOf, keepDelimsL, split, splitWhen, whenElt) import Data.List.Split (chunksOf, keepDelimsL, split, whenElt)
import Data.Maybe (isJust)
import Data.Vector (Vector) import Data.Vector (Vector)
import qualified Data.Vector as V import qualified Data.Vector as V