A template repository providing a simple framework for Advent of Code puzzles.
After you create a new project based on the current template repository using the **Use this template ** button, a bare minimal scaffold will appear in your GitHub account with the following structure:
.
├── README.md README file
├── build.gradle.kts Gradle configuration created with Kotlin DSL
├── gradle
│ └── wrapper Gradle Wrapper
├── gradle.properties Gradle configuration properties
├── gradlew *nix Gradle Wrapper script
├── gradlew.bat Windows Gradle Wrapper script
├── src Generic framework utilities
└── calendar Your very own sandbox to solve the puzzles
└── dayX Each day has a dedicated package for it
├── DayX.kt An empty implementation class for the AoC day X [1-25]
├── part1.txt AoC day X [1-25] input data for part 1
└── part2.txt AoC day X [1-25] input data for part 2
Note: All task input files are empty in the repository – we should not post them publicly, as Eric Wastl asks for: Tweet.
To help with that, the template contains a git hook that prevents committing anything if input files are not empty. There's also
./gradlew cleanInputs
task for easy cleanup.Please make sure not to commit input data once after you fill those files in.
Here's the overview of your daily routine while solving AoC puzzles:
- Open
./calendar/dayX
directory for the day you're solving. - Paste your input for part1 into
part1.txt
. - Open
DayX.kt
file and implement your solution inpart1
method and return your answer. - Check your solution for part1 by running
./gradlew test --tests='dayX.DayX.part1'
- Paste your input for part2 into
part2.txt
(only if it's different frmpart1
, otherwisepart1.txt
will be used. - Open
DayX.kt
file and implement your solution inpart2
method and return your answer. - Check your solution for part2 by running
./gradlew test --tests='dayX.DayX.part2'
- Check both your solutions by running
./gradlew test --tests='dayX.DayX'
- Submit your answers to AoC
- Clean up inputs by running
./gradlew cleanInputs
- Commit your code by running
git commit -a -m "AoC DayX"
- Push the changes by running
git push
- Profit??
Often inputs for
part1
andpart2
are the same. The framework handles that by falling back topart1
input file ifpart2
input is left empty.