summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Lasseter <user@4574.co.uk>2024-12-10 19:29:47 +0000
committerNat Lasseter <user@4574.co.uk>2024-12-10 19:29:47 +0000
commit1aa6ad0d6d14d08b44ef4b7f23b5ee3d5d976bd2 (patch)
tree18e096286614c7bdc5703f9490c35372b600208f
parent312ca2cd3e9d307c114ec5cd362f493fcddbead4 (diff)
[Day 10] Part 2: Oh I already did that. Great, I guess. :)
-rw-r--r--day10/day10.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/day10/day10.hs b/day10/day10.hs
index 5c970e5..8b063dd 100644
--- a/day10/day10.hs
+++ b/day10/day10.hs
@@ -69,12 +69,19 @@ score th =
where
untrail (Point c _ _) = c
+rating :: [Trail] -> Int
+rating = length
+
part1 :: Map -> Int
part1 mp =
sum $ map (score . (trails mp)) $ trailheads mp
+part2 :: Map -> Int
+part2 mp =
+ sum $ map (rating . (trails mp)) $ trailheads mp
+
main = do
file <- readFile "day10.input"
let mp = consume file
putStrLn ("Part 1: " ++ (show $ part1 mp))
- --putStrLn ("Part 2: " ++ (show $ part2 mp))
+ putStrLn ("Part 2: " ++ (show $ part2 mp))