Day 18
This commit is contained in:
19
day18/Part1.hs
Normal file
19
day18/Part1.hs
Normal 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 []
|
||||
Reference in New Issue
Block a user