Skip to content

Commit

Permalink
Added comment
Browse files Browse the repository at this point in the history
  • Loading branch information
cdimitroulas committed Dec 23, 2023
1 parent a7cace1 commit cfccfc0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Solutions/Day08.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cfccfc0

Please sign in to comment.