projects
/
advent-of-code-21.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ef4c074
)
Updated link for day 13
author
Neil Smith
<neil.git@njae.me.uk>
Mon, 13 Dec 2021 21:03:23 +0000
(21:03 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Mon, 13 Dec 2021 21:03:23 +0000
(21:03 +0000)
advent13/Main.hs
patch
|
blob
|
history
diff --git
a/advent13/Main.hs
b/advent13/Main.hs
index 69afc492d84825aba2127a7481862a0b3434990d..89aecf43d6a15961c70fc200af1e1735d6de1b5f 100644
(file)
--- 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
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)
data Fold = Fold Axis Int
deriving (Eq, Ord, Show)
-
-
main :: IO ()
main =
do text <- TIO.readFile "data/advent13.txt"
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
-- 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
dotP = V2 <$> decimal <* "," <*> decimal
foldsP = foldP `sepBy` endOfLine