Skip to content

shnako/advent-of-code-2020

Repository files navigation

Advent of Code 2020 🎄

AoC 2020 provided the perfect opportunity to try a new language, so I decided to use Kotlin.

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.

Day Puzzle Solution Results Input Text
01 Report Repair Day 01 solution Day 01 test Day 01 input Day 01 puzzle
02 Password Philosophy Day 02 solution Day 02 test Day 02 input Day 02 puzzle
03 Toboggan Trajectory Day 03 solution Day 03 test Day 03 input Day 03 puzzle
04 Passport Processing Day 04 solution Day 04 test Day 04 input Day 04 puzzle
05 Binary Boarding Day 05 solution Day 05 test Day 05 input Day 05 puzzle
06 Custom Customs Day 06 solution Day 06 test Day 06 input Day 06 puzzle
07 Handy Haversacks Day 07 solution Day 07 test Day 07 input Day 07 puzzle
08 Handheld Halting Day 08 solution Day 08 test Day 08 input Day 08 puzzle
09 Encoding Error Day 09 solution Day 09 test Day 09 input Day 09 puzzle
10 Adapter Array Day 10 solution Day 10 test Day 10 input Day 10 puzzle
11 Seating System Day 11 solution Day 11 test Day 11 input Day 11 puzzle
12 Rain Risk Day 12 solution Day 12 test Day 12 input Day 12 puzzle
13 Shuttle Search Day 13 solution Day 13 test Day 13 input Day 13 puzzle
14 Docking Data Day 14 solution Day 14 test Day 14 input Day 14 puzzle
15 Rambunctious Recitation Day 15 solution Day 15 test Day 15 input Day 15 puzzle
16 Ticket Translation Day 16 solution Day 16 test Day 16 input Day 16 puzzle
17 Conway Cubes Day 17 solution Day 17 test Day 17 input Day 17 puzzle
18 Operation Order Day 18 solution Day 18 test Day 18 input Day 18 puzzle
19 Monster Messages Day 19 solution Day 19 test Day 19 input Day 19 puzzle
20 Jurassic Jigsaw Day 20 solution Day 20 test Day 20 input Day 20 puzzle
21 Allergen Assessment Day 21 solution Day 21 test Day 21 input Day 21 puzzle
22 Crab Combat Day 22 solution Day 22 test Day 22 input Day 22 puzzle
23 Crab Cups Day 23 solution Day 23 test Day 23 input Day 23 puzzle
24 Lobby Layout Day 24 solution Day 24 test Day 24 input Day 24 puzzle
25 Combo Breaker Day 25 solution Day 25 test Day 25 input Day 25 puzzle

Structure

The corresponding files for each solution are grouped within a dayXX package.

Each solution implements the GenericSolution interface and must implement the runPart1 and runPart2 methods which return the result as a string.

Each test extends the GenericSolutionTest class and must specify the expected results under expectedPart1Result and expectedPart2Result, which keeps the tests very clean.

The corresponding files for each puzzle are located within a dayXX folder.

Each folder contains:

  • 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

Running

All solutions via tests

You can run all the tests using gradle:

./gradlew test

or if you're using Windows:

gradlew.bat test

Individual solutions via main

You can also take advantage of the functionality implemented in main.kt 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.

Results

Dashboard

Advent of Code 2020 Dashboard Result

Company Leaderboard

Anonymized Private Company Leaderboard