This commit is contained in:
2023-12-18 15:21:29 +01:00
parent a8d5a79235
commit 5d826bffff
5 changed files with 154 additions and 0 deletions

19
day18/Part1.hs Normal file
View File

@@ -0,0 +1,19 @@
module Part1 where
import Commons
import Data.List.Utils (split)
import GHC.IO.Handle (isEOF)
import Data.Map (fromList)
parseLine :: (Int, Int) -> String -> ((Int, Int), Hole)
parseLine coords line = let (d: n: _) = split " " line
actualD = case d of
"U" -> North
"D" -> South
"R" -> East
"L" -> West
in parseInstruction coords actualD (read n)
parse :: [String] -> Grid
parse lines = parseGrid parseLine lines []