days 20-24 (day 24 excluded for input confidentiality)

This commit is contained in:
toastyandwarm 2024-12-24 17:21:31 +00:00
parent 26f16c9297
commit 5de9ac11ea
5 changed files with 256 additions and 1 deletions

View file

@ -38,10 +38,10 @@ toSquare 'S' = Just Square {visited=False, distance=Nothing, start=True, end=Fa
toSquare 'E' = Just Square {visited=True, distance=Just 0, start=False, end=True}
toSquare _ = Nothing
--partial!
splitInput :: String -> [[Char]]
splitInput = split "\n"
--partial!
buildArray :: [[Char]] -> (Array (Int, Int) Square)
buildArray grid = listArray ((0, 0), ((length grid)-1, (length (grid!!0))-1)) . concat . map (map (fromJust . toSquare)) $ grid