20 lines
643 B
Haskell
20 lines
643 B
Haskell
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 []
|