Expand description
This is my solution for Advent of Code - Day 16: Reindeer Maze
parse_input
turns the puzzle input into a Maze
Maze::lowest_scoring_route
solves part 1 using A*
graph search, with Position
tracking the progress
through the maze, with Position::next
providing next steps from each position, using
CoordinateExtensions::manhattan_distance
and CoordinateExtensions::turn_cost
as the heuristic to estimate
remaining distance from a node.
Maze::count_visited_by_best_routes
solves part 2, using similar techniques, but running until all possible
best routes are found, and analysing Position
.visited
lists to produce the answer.
Structs§
- Maze 🔒
- Position 🔒A node in the graph search storing the position and facing, the score and estimated distance to the goal to allow ordering, and a record of the path taken to reach this node.
Enums§
- Facing 🔒To track the reindeer’s current facing in the maze
Traits§
- Helper trait to add methods to the built-in
(u8, u8)
Coordinate type
Functions§
- Turn the puzzle input into the internal representation.
- The entry point for running the solutions with the ‘real’ puzzle input.