🎅 === Advent of Code 2022 === 🎅
🎄 --- Day 01: Calorie Counting ---
🌟 Part 1: 71502 (4.9ms)
🌟 Part 2: 208191 (3.42ms)
🎄 --- Day 02: Rock Paper Scissors ---
🌟 Part 1: 9651 (4.71ms)
🌟 Part 2: 10560 (2.86ms)
🎄 --- Day 03: Rucksack Reorganization ---
🌟 Part 1: 7553 (4.26ms)
🌟 Part 2: 2758 (1.83ms)
🎄 --- Day 4: Camp Cleanup ---
🌟 Part 1: 450 (3.52ms)
🌟 Part 2: 837 (2.5ms)
🎄 --- Day 5: Supply Stacks ---
🌟 Part 1: MQTPGLLDN (7.32ms)
🌟 Part 2: LVZPSTTCZ (4.71ms)
🎄 --- Day 6: Tuning Trouble ---
🌟 Part 1: 1080 (9.47ms)
🌟 Part 2: 3645 (4.73ms)
🎄 --- Day 7: No Space Left On Device ---
🌟 Part 1: 1582412 (11.92ms)
🌟 Part 2: 3696336 (74.4us)
🎄 ---- Day 8: Treetop Tree House ---
🌟 Part 1: 1763 (27.7ms)
🌟 Part 2: 671160 (7.8us)
🎄 ---- Day 9: Rope Bridge ---
🌟 Part 1: 6026 (28.7ms)
🌟 Part 2: 2273 (22.2ms)
🎄 ---- Day 10: Cathode-Ray Tube ---
🌟 Part 1: 12980 (12.51ms)
🌟 Part 2: BRJLFULP (8.1us)
🎄 ---- Day 11: Monkey in the Middle ---
🌟 Part 1: 76728 (30.8ms)
🌟 Part 2: 21553910156 (100.1ms)
🎄 ---- Day 12: Hill Climbing Algorithm ---
🌟 Part 1: 391 (21.16ms)
🌟 Part 2: 386 (237.14ms)
🎄 ---- Day 13: Distress Signal ---
🌟 Part 1: 5292 (43.82ms)
🌟 Part 2: 23868 (8.9us)
🎄 ---- Day 14: Regolith Reservoir ---
🌟 Part 1: 843 (255.6ms)
🌟 Part 2: 27625 (8us)
🎄 ---- Day 15: Beacon Exclusion Zone ---
🌟 Part 1: 5688618 (1.89s)
🌟 Part 2: 12625383204261 (238.56ms)
🎄 ---- Day 16: Proboscidea Volcanium ---
🌟 Part 1: 1653 (204.21ms)
🌟 Part 2: 2223 (18.3s)
🎄 ---- Day 17: Pyroclastic Flow ---
🌟 Part 1: 3126 (281.5ms)
🌟 Part 2: 1561176470570 (1.22s)
I just discovered p5js, so this year I will try to create some animations about the input I get from AOC.
See: visualizations.
I gather screenshots at each step (most of) of each years, so that I can make videos about the AOC filling up during december.
See: screenshots.
After the 6 last years with Java, Go (finished with Java), OCaml (finished with Java), Python and Clojure (+ some Java), Kotlin, this year I'll be solving the Advent of Code with Kotlin again.
- A deep dive into Kotlin.
- Write fast and idiomatic solutions.
- Using extensions to make code shorter (see Extensions.kt).
I am gradually rewriting all previous years solutions in Kotlin because it's a better language for such challenges than the other I used before (except Python, but I'm not doing so much Python so just forgetting how to write some basic stuff).
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 for all years - Run
./gradlew run --args $DAY
to run a specific day in the current year (2021, ex:./gradlew run --args 8
to run the day 8 of 2021) - Run
./gradlew run --args $YEAR/*
to run all days in a specific year (ex:./gradlew run --args 2015/*
to run the year 2015) - Run
./gradlew run --args $YEAR/$DAY
to run a specific year & day (ex:./gradlew run --args 2015/7
to run the day 7 of 2015) - Run
./gradlew run --args input-$DAY
to download the input for a specific day for the current year, provided acookie.txt
file insrc/main/resources.txt
which contains your Advent of Code cookie (ex:./gradlew run --args input-6
to run the day 6 of 2021) - Run
./gradlew run --args input-$YEAR/$DAY
to download the input for a specific day in a specific year, provided acookie.txt
file insrc/main/resources.txt
which contains your Advent of Code cookie (ex:./gradlew run --args input-2015/7
to run the day 7 of 2015)
- 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 Day01Test
class shows a test of the functionality of Day01
where the test input differs from the actual input.
- Inputs go into
src/main/resources
and follow the naming conventionX.txt
where X is like01
,02
and so on - Solutions go into
src/main/kotlin/days
and extend theDay
abstract class, calling its constructor with their day number - Solutions follow the naming convention
DayX
- It is assumed all solutions will have two parts but share the same input
- Input is exposed in the solution classes in two forms -
inputList
andinputString
- Day 1 solution class and input file are stubbed as a guide on how to extend the project,
and how you can use the
inputList
andinputString
mentioned above - To get started simply replace
src/main/01.txt
with the real input and the solutions inDay01
with your own - A Day 1 test class also exists, mostly to show a few hamcrest matchers, and how test input files can differ from actual ones (see Test input section above).
To get started with testing you can edit this class, and the input file at
src/test/resources/01.txt