From cfccfc0acf2349ae628b4696a78fefd5fe72add0 Mon Sep 17 00:00:00 2001 From: cdimitroulas Date: Sat, 23 Dec 2023 17:10:05 +0200 Subject: [PATCH] Added comment --- src/Solutions/Day08.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Solutions/Day08.hs b/src/Solutions/Day08.hs index 7408f0c..6fdee14 100644 --- a/src/Solutions/Day08.hs +++ b/src/Solutions/Day08.hs @@ -35,6 +35,8 @@ turn 'L' = fst turn 'R' = snd runPath :: Input -> String -> Int -> Int +-- We just check the last char is Z so that it works for both part 1 and 2 even though technically +-- part 1 requires us to look for "ZZZ" runPath _ node steps | last node == 'Z' = steps runPath input@(directions, mapLines) node0 steps = let node1 = turn (directions !! steps) (mapLines M.! node0)