Update readme to always refer to puzzle parts with numerals

This commit is contained in:
Stefan Müller 2025-07-08 20:54:30 +02:00
parent 03788ddf55
commit d9fdb22bab

View File

@ -48,9 +48,9 @@ My implementation uses an ordering matrix (a two-dimensional boolean array) to t
:mag_right: Puzzle: <https://adventofcode.com/2024/day/6>, :white_check_mark: Solver: [`GuardGallivant.cpp`](src/GuardGallivant.cpp) :mag_right: Puzzle: <https://adventofcode.com/2024/day/6>, :white_check_mark: Solver: [`GuardGallivant.cpp`](src/GuardGallivant.cpp)
The solver for this puzzle simply simulates the guard traversing the map, turning them right at obstacles and counting the unique positions the guard will visit for part one. At each newly visited position, the algorithm will place a temporary obstacle at the next empty position and check if that obstacle will create a cycle for part two. The solver for this puzzle simply simulates the guard traversing the map, turning them right at obstacles and counting the unique positions the guard will visit for part 1. At each newly visited position, the algorithm will place a temporary obstacle at the next empty position and check if that obstacle will create a cycle for part 2.
In order to improve performance for part two, the solver backtraces at turns to find all steps on the map that would lead to the position the guard is currently in, and uses this data to find cycles early. In order to improve performance for part 2, the solver backtraces at turns to find all steps on the map that would lead to the position the guard is currently in, and uses this data to find cycles early.
### Day 7: Bridge Repair ### Day 7: Bridge Repair
@ -68,7 +68,7 @@ For any pair of antennas of the same frequency, the algorithm adds the differenc
:mag_right: Puzzle: <https://adventofcode.com/2024/day/9>, :white_check_mark: Solver: [`DiskFragmenter.cpp`](src/DiskFragmenter.cpp) :mag_right: Puzzle: <https://adventofcode.com/2024/day/9>, :white_check_mark: Solver: [`DiskFragmenter.cpp`](src/DiskFragmenter.cpp)
The input string is processed simultaneously from both ends to calculate the checksums of files or file blocks without actually moving them. The algorithm does not have to keep track of positions for specific files or file blocks. For part two, a list of empty spaces is maintained, but only up to the point where the front and back processing meets. An array of indices per possible file size, where each index tracks the first empty space that could hold a file of that size and advances as needed, is also kept to speed up the search in the list of empty spaces. The input string is processed simultaneously from both ends to calculate the checksums of files or file blocks without actually moving them. The algorithm does not have to keep track of positions for specific files or file blocks. For part 2, a list of empty spaces is maintained, but only up to the point where the front and back processing meets. An array of indices per possible file size, where each index tracks the first empty space that could hold a file of that size and advances as needed, is also kept to speed up the search in the list of empty spaces.
### Day 10: Hoof It ### Day 10: Hoof It
@ -138,7 +138,7 @@ For part 2, the algorithm appends iteratively 3-digit binary numbers in such a w
After the solver tracked the first 1024 corrupted memory positions, it constructs a graph of all remaining positions and their adjacencies, and runs Dijkstra's algorithm I already used for [day 16](#day-16-reindeer-maze) to calculate the length of the shortest path to the exit. After the solver tracked the first 1024 corrupted memory positions, it constructs a graph of all remaining positions and their adjacencies, and runs Dijkstra's algorithm I already used for [day 16](#day-16-reindeer-maze) to calculate the length of the shortest path to the exit.
Conveniently, Dijkstra's algorithm also finds the shortest path itself, so after each additional falling byte, the algorithm checks whether it hit the current shortest path and if so, tries to find a new one to the exit. The solution for part two is found once this there is no path any more. Conveniently, Dijkstra's algorithm also finds the shortest path itself, so after each additional falling byte, the algorithm checks whether it hit the current shortest path and if so, tries to find a new one to the exit. The solution for part 2 is found once this there is no path any more.
### Day 19: Linen Layout ### Day 19: Linen Layout
@ -180,7 +180,7 @@ After each secret number has been calculated, the new price and price change are
This solver was the driver of unifying and generalizing the [graph implementation](include/aoc/common/Graph.hpp) used already for [day 16](#day-16-reindeer-maze) and [day 18](#day-18-ram-run). This solver was the driver of unifying and generalizing the [graph implementation](include/aoc/common/Graph.hpp) used already for [day 16](#day-16-reindeer-maze) and [day 18](#day-18-ram-run).
For part one, the algorithm takes each vertex starting with `t` and checks for each pair of its neighbors if they are connected. If so, a unique 3-clique has been found. For part 1, the algorithm takes each vertex starting with `t` and checks for each pair of its neighbors if they are connected. If so, a unique 3-clique has been found.
The general problem of finding a maximum clique in a graph is *NP hard*, but the constraints and the graph structure allow for a fast algorithm. Firstly, it is notable that each vertex has the same degree, which suggests that the clique number (the size of the maximum clique) might be close to that, and again at least one vertex starting with `t` shall be included. The general problem of finding a maximum clique in a graph is *NP hard*, but the constraints and the graph structure allow for a fast algorithm. Firstly, it is notable that each vertex has the same degree, which suggests that the clique number (the size of the maximum clique) might be close to that, and again at least one vertex starting with `t` shall be included.