I've only used Python in my last job, so I'll use AoC 2022 as a refresher in Java.
I tried to make the code as clean and easy to read as possible, and I've also provided a short explanation to most solutions so that they're easier to understand.
The corresponding files for each solution are grouped within a dayXX package. Each package contains:
- Solution.java: my implementation of the solution to the puzzle
- puzzle.txt: a dump of the puzzle text from the website, with the source link at the top
- input.txt: the puzzle input I received
Each solution extends the SolutionBase interface and must implement the runPart1 and runPart2 methods which return the result as a string.
Each test implements the SolutionBaseTest interface and must specify the expected results in the test assertions.
You can run all the tests using gradle:
./gradlew test
or if you're using Windows:
gradlew.bat test
You can also take advantage of the functionality implemented in Main.java to run the puzzles individually:
./gradlew run --args='<day> <part>'
or if you're using Windows:
gradlew.bat run --args="<day> <part>"
replacing <day>
with the puzzle's day number and <part>
with either 1 or 2, or 0 to run both parts.
Running without the arguments will prompt you to enter them.