🎄 Advent of Code 🎄
My solutions in Kotlin
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 run
orjava -jar build/libs/AdventOfCode.jar
-
All puzzles for a given year:
./gradlew run --args "2020"
orjava -jar build/libs/AdventOfCode.jar 2020
-
A single puzzle for a given year and day:
./gradlew run --args "2020/25"
orjava -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"
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.
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/inputs
and follow the naming conventionyearXXXX/dayYY.txt
- Solutions go into
src/main/kotlin/adventofcode
and follow the naming conventionyearXXXX/DayYYZZZZ.kt
- Solutions extend the
Puzzle
class and call its constructor passing an optional alternative input - Solutions can have one or two parts sharing the same input. Not overriding
fun partTwo(): Any
will skip the second part when running the puzzle
- Check formatting:
./gradlew ktlintCheck
- Fix formatting:
./gradlew ktlintFormat