From: Neil Smith Date: Mon, 13 Dec 2021 21:03:23 +0000 (+0000) Subject: Updated link for day 13 X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=a220dea27279c4a26dc9d80c191ef47f53815cfc;p=advent-of-code-21.git Updated link for day 13 --- diff --git a/advent13/Main.hs b/advent13/Main.hs index 69afc49..89aecf4 100644 --- a/advent13/Main.hs +++ b/advent13/Main.hs @@ -1,5 +1,4 @@ --- Writeup at https://work.njae.me.uk/2021/12/09/advent-of-code-2021-day-8/ - +-- Writeup at https://work.njae.me.uk/2021/12/13/advent-of-code-2021-day-13/ import Data.Text () import qualified Data.Text.IO as TIO @@ -22,8 +21,6 @@ data Axis = X | Y data Fold = Fold Axis Int deriving (Eq, Ord, Show) - - main :: IO () main = do text <- TIO.readFile "data/advent13.txt" @@ -66,9 +63,9 @@ showSheet sheet = unlines [ concat [showPoint (V2 x y) | x <- ([0..maxX] :: [Int -- Parse the input file -inputP = (,) <$> sheetP <* (many1 endOfLine) <*> foldsP +inputP = (,) <$> sheetP <* many1 endOfLine <*> foldsP -sheetP = S.fromList <$> (dotP `sepBy` endOfLine) +sheetP = S.fromList <$> dotP `sepBy` endOfLine dotP = V2 <$> decimal <* "," <*> decimal foldsP = foldP `sepBy` endOfLine