This project contains solutions to the Advent of Code 2021 challenge in Kotlin. Advent of Code is an Advent calendar of small programming puzzles by Eric Wastl.
- Day 1: π§Ή Sonar Sweep -- Day1.kt
- Day 2: β¬ Dive! -- Day2.kt
- Day 3: π©Ί Binary Diagnostic -- Day3.kt
- Day 4: π¦ Giant Squid -- Day4.kt
- Day 5: πΆβπ«οΈ Hydrothermal Venture -- Day5.kt
- Day 6: π Lanternfish -- Day6.kt
- Day 7: π¦ The Treachery of Whales -- Day7.kt
- Day 8: 7 Seven Segment Search -- Day8.kt
- Day 9: π Smoke Basin -- Day9.kt
- Day 10: π¬ Syntax Scoring -- Day10.kt
- Day 11: π Dumbo Octopus -- Day11.kt
- Day 12: πβ Passage Pathing -- Day12.kt
- Day 13: π Transparent Origami -- Day13.kt
- Day 14: πͺ Extended Polymerization -- Day14.kt
- Day 15: π¦ͺ Chiton -- Day15.kt
- Day 16: π¦ Packet Decoder -- Day16.kt
- Day 17: πͺ Trick Shot -- Day17.kt
- Day 18: π‘ Snailfish -- Day18.kt
- Day 19: π Beacon Scanner -- Day19.kt
- Day 20: πΊ Trench Map -- Day20.kt
- Day 21: π² Dirac Dice -- Day21.kt
- Day 22: π Reactor Reboot -- Day22.kt
- Day 23: πΈ Amphipod -- Day23.kt
- Day 24: π° Arithmetic Logic Unit -- Day24.kt
- Day 25: π₯ Sea Cucumber -- Day25.kt
- Gradle setup so you can run a specific day or all days on the command line (see Running)
- Timings for each part of each day
- Input for each day automatically exposed in String and List form
- Junit 5 and AssertJ test libraries included (see Testing)
- Starter .gitignore
Project is already setup with gradle. To run the app:
- Navigate to top-level directory on the command line
- Run
./gradlew run
to run all days - Run
./gradlew run --args $DAY
where$DAY
is an integer to run a specific day - Run
./gradlew run --args "$DAY1 $DAY2 $ANOTHERDAY"
to run a subset of days
Project includes JUnit and AssertJ and a stub unit test to get you going. To run all tests:
- Navigate to top-level directory on the command line
- Run
./gradlew test
- Add
--info
,--debug
or--stacktrace
flags for more output
By default, instantiations of Day
classes in tests will use the input files in src/test/resources
, not those
in src/main/resources
. This hopefully gives you flexibility - you could either just copy the real input
into src/test/resources
if you want to test the actual answers, or you could add a file of test data based on the
examples given on the Advent of Code description for the day. The stub Day1Test
class shows a test of the
functionality of Day1
where the test input differs from the actual input.
- Inputs go into
src/main/resources
and follow the naming conventioninput_day_X.txt
- Solutions go into
src/main/kotlin/days
and implement thePuzzle
interface - Solutions follow the naming convention
DayX
- It is assumed all solutions will have two parts
- It is assumed that the puzzle input is provided through the primary constructor
- You can use the
InputReader
methods for reading input - To get started simply replace
src/main/resources/input_day_1.txt
with the real input and the solutions inDay1
with your own