Expand description
This is my solution for Advent of Code - Day 10: Hoof It
parse_input
turns the input file into a TopographicalMap
, where most of the logic is.
TopographicalMap::total_score
solves part 1, and TopographicalMap::total_rating
solves part 2. Both use
TopographicalMap::trailheads
to get a list of starting points, which are passed to
TopographicalMap::score_trailhead
and TopographicalMap::rate_trailhead
respectively. These both use
TopographicalMap::get_peaks
to recursively walk the trail permutations and get a list of peaks that terminate
them. The score (part 1) gets the unique peaks before counting them, the rating counts the duplicates.
Structs§
- Represent the map as a list of lists of cells. Most of the business logic for today’s puzzles are functions implemented on this struct.
Functions§
- Parse the puzzle input into the internal representation
- The entry point for running the solutions with the ‘real’ puzzle input.