60 lines
3.4 KiB
Markdown
60 lines
3.4 KiB
Markdown
# AdventOfCode2025
|
|
|
|
Solver for Advent of Code 2025 puzzles. <https://adventofcode.com/2025/>
|
|
|
|
This is a single command line application for the puzzles written in [Rust](https://rust-lang.org/).
|
|
|
|
## Puzzle Input
|
|
|
|
This project does not contain the puzzle or example inputs as per the [copyright notice of Advent of Code](https://adventofcode.com/about). In order to run the compiled application, the puzzle inputs have to be downloaded from the [Advent of Code 2025](https://adventofcode.com/2025/) puzzle pages, and placed as text files into the `AdventOfCode2025\data` directory, e.g. `AdventOfCode2025\data\secret_entrance.txt`, or `AdventOfCode2025\data\example\secret_entrance.txt` for the unit tests. The application will output an error message with details if it cannot find an input file.
|
|
|
|
## Solutions
|
|
|
|
### Day 1: Secret Entrance
|
|
|
|
:mag_right: Puzzle: <https://adventofcode.com/2025/day/1>, :white_check_mark: Solver: [`SecretEntrance`](src/solvers/secret_entrance.rs)
|
|
|
|
For this one, we are moving around a dial with some not too complicated modulo calculations.
|
|
|
|
### Day 2: Gift Shop
|
|
|
|
:mag_right: Puzzle: <https://adventofcode.com/2025/day/2>, :white_check_mark: Solver: [`GiftShop`](src/solvers/gift_shop.rs)
|
|
|
|
Firstly, we calculate directly the sum of invalid IDs composed of two identical sequences of digits for part 1. This can easily be generalized for any number of repetitions of sequences. However, the problem is to avoid adding certain invalid IDs to the sum multiple times. Therefore we only check prime numbers of repetitions, and take care that invalid IDs that are composed of a repetition of a single digit are only counted once.
|
|
|
|
On top of that we use a cache to avoid recalculating prime factors and certain helper variables for given ID lengths and repetition counts.
|
|
|
|
### Day 4: Printing Department
|
|
|
|
:mag_right: Puzzle: <https://adventofcode.com/2025/day/4>, :white_check_mark: Solver: [`PrintingDepartment`](src/solvers/printing_department.rs)
|
|
|
|
### Day 5: Cafeteria
|
|
|
|
:mag_right: Puzzle: <https://adventofcode.com/2025/day/5>, :white_check_mark: Solver: [`Cafeteria`](src/solvers/cafeteria.rs)
|
|
|
|
### Day 6: Trash Compactor
|
|
|
|
:mag_right: Puzzle: <https://adventofcode.com/2025/day/6>, :white_check_mark: Solver: [`TrashCompactor`](src/solvers/trash_compactor.rs)
|
|
|
|
### Day 8: Playground
|
|
|
|
:mag_right: Puzzle: <https://adventofcode.com/2025/day/8>, :white_check_mark: Solver: [`Playground`](src/solvers/playground.rs)
|
|
|
|
### Day 9: Movie Theater
|
|
|
|
:mag_right: Puzzle: <https://adventofcode.com/2025/day/9>, :white_check_mark: Solver: [`MovieTheater`](src/solvers/movie_theater.rs)
|
|
|
|
## Tests
|
|
|
|
The package contains unit tests for each solver to help troubleshoot issues and prevent regressions. These tests cover the solutions for provided examples and full data inputs. The solutions used within the tests are user-specific.
|
|
|
|
## License
|
|
|
|
Copyright (C) 2025-2026 Stefan Müller
|
|
|
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|