🎄 Advent of Code 🎄
My solutions in Kotlin
Legend: ★: Both stars for that day • ☆: Just the first star
Year |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
1 0 |
1 1 |
1 2 |
1 3 |
1 4 |
1 5 |
1 6 |
1 7 |
1 8 |
1 9 |
2 0 |
2 1 |
2 2 |
2 3 |
2 4 |
2 5 |
★ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2015 | ★️ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ☆ | ★ | 39 | |||||
| 2016 | ☆ | ☆ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ☆ | 21 | |||||||||||||
| 2017 | ★ | ★ | ★ | ★ | ★ | 10 | ||||||||||||||||||||
| 2018 | ★ | ★ | ★ | ★ | 8 | |||||||||||||||||||||
| 2019 | ★ | ★ | ★ | 6 | ||||||||||||||||||||||
| 2020 | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ☆ | ☆ | ★ | ★ | ☆ | ★ | ☆ | 44 | |
| 2021 | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | 26 | ||||||||||||
| 2022 | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ☆ | ☆ | 28 | ||||||||||
| 2023 | ★ | ★ | ★ | ★ | ☆ | ★ | ☆ | 12 | ||||||||||||||||||
| 2024 | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ☆ | ★ | ★ | ★ | ★ | ★ | ☆ | 40 | ||||
| 2025 | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ★ | ☆ | ★ | – | – | – | – | – | – | – | – | – | – | – | – | – | 21 |
Puzzles can be run using the Gradle run task or by executing the project's JAR file:
-
All available puzzles (all years and days):
./gradlew runorjava -jar build/libs/AdventOfCode.jar -
All puzzles for a given year:
./gradlew run --args 2020orjava -jar build/libs/AdventOfCode.jar 2020 -
A single puzzle for a given year and day:
./gradlew run --args 2020/25orjava -jar build/libs/AdventOfCode.jar 2020/25
These arguments can be combined to run multiple puzzles, e.g. ./gradlew run --args "2015/1 2019 2020/6 2020/7" or
java -jar build/libs/AdventOfCode.jar 2015/1 2019 2020/6 2020/7 will run the first puzzle from 2015, then all puzzles from 2019 and lastly
the 6th and 7th puzzle from 2020.
Runtimes that exceed 15s are highlighted in red.
This project contains a Dockerfile to build the project and run the puzzles:
-
To build the Docker image:
docker build -t pfolta/advent-of-code:latest . -
To run all available puzzles (all years and days) in Docker (and remove the container afterwards):
docker run --rm pfolta/advent-of-code:latest -
All puzzles for a given year:
docker run --rm pfolta/advent-of-code:latest 2020 -
A single puzzle for a given year and day:
docker run --rm pfolta/advent-of-code:latest 2020/25
And just as when running the JAR archive natively, these arguments can be combined to run multiple puzzles, e.g.
docker run --rm pfolta/advent-of-code:latest 2015/1 2019 2020/6 2020/7 will run the first puzzle from 2015, then all puzzles from 2019 and
lastly the 6th and 7th puzzle from 2020.
Legend: XXXX: Year (4 digits, e.g. 2020) • YY: Day (leading zero, e.g. 07) • ZZZZ: Puzzle name (UpperCamelCase,
e.g. HandyHaversacks)
- Inputs go into
src/main/resources/inputsand follow the naming conventionyearXXXX/dayYY.txt - Solutions go into
src/main/kotlin/adventofcodeand follow the naming conventionyearXXXX/DayYYZZZZ.kt - Solutions extend the
Puzzleclass and call its constructor passing an optional alternative input - Solutions can have one or two parts sharing the same input. Not overriding
fun partTwo(): Anywill skip the second part when running the puzzle
- Check formatting:
./gradlew ktlintCheck - Fix formatting:
./gradlew ktlintFormat