Skip to content

🎄 Advent of Code: Solutions in Kotlin

License

Notifications You must be signed in to change notification settings

pfolta/AdventOfCode

Repository files navigation

Sample run 🎄 Advent of Code 🎄

My solutions in Kotlin

License: MIT Build Status Code Coverage

⭐️ Progress

2015 Progress
2016 Progress
2017 Progress
2018 Progress
2019 Progress
2020 Progress
2021 Progress
2022 Progress
2023 Progress

🛷 How to run

Puzzles can be run using the Gradle run task or by executing the project's JAR file:

  • All available puzzles (all years and days):
    ./gradlew run or java -jar build/libs/AdventOfCode.jar

  • All puzzles for a given year:
    ./gradlew run --args "2020" or java -jar build/libs/AdventOfCode.jar 2020

  • A single puzzle for a given year and day:
    ./gradlew run --args "2020/25" or java -jar build/libs/AdventOfCode.jar 2020/25

These arguments can be combined to run multiple puzzles, e.g. ./gradlew run --args "2015/1 2019 2020/6 2020/7" will run the first puzzle from 2015, then all puzzles from 2019 and lastly the 6th and 7th puzzle from 2020.

Runtimes that exceed 15s are highlighted in red.

🎅🏻 Structure

Legend: XXXX: Year (4 digits, e.g. 2020) • YY: Day (leading zero, e.g. 07) • ZZZZ: Puzzle name (UpperCamelCase, e.g. HandyHaversacks)

  • Inputs go into src/main/resources/inputs and follow the naming convention yearXXXX/dayYY.txt
  • Solutions go into src/main/kotlin/adventofcode and follow the naming convention yearXXXX/DayYYZZZZ.kt
  • Solutions extend the Puzzle class and call its constructor passing an optional alternative input
  • Solutions can have one or two parts sharing the same input. Not overriding fun partTwo(): Any will skip the second part when running the puzzle

🎁 Index

Year Day Puzzle Links ⭐️ Part 1 ⭐️ Part 2
2015 1 Not Quite Lisp [Code] [Test] 232 1783
2 I Was Told There Would Be No Math [Code] [Test] 1598415 3812909
3 Perfectly Spherical Houses in a Vacuum [Code] [Test] 2565 2639
4 The Ideal Stocking Stuffer [Code] [Test] 282749 9962624
5 Doesn't He Have Intern-Elves For This? [Code] [Test] 238 69
6 Probably a Fire Hazard [Code] [Test] 377891 14110788
7 Some Assembly Required [Code] 16076 2797
8 Matchsticks [Code] [Test] 1333 2046
9 All in a Single Night [Code] [Test] 207 804
10 Elves Look, Elves Say [Code] 492982 6989950
11 Corporate Policy [Code] [Test] vzbxxyzz vzcaabcc
12 JSAbacusFramework.io [Code] [Test] 111754 65402
13 Knights of the Dinner Table [Code] [Test] 618 601
14 Reindeer Olympics [Code] 2696 1084
15 Science for Hungry People [Code] [Test] 21367368 1766400
16 Aunt Sue [Code] 213 323
17 No Such Thing as Too Much [Code] [Test] 1638 17
18 Like a GIF For Your Yard [Code] 768 781
19 Medicine for Rudolph [Code] [Test] 518
20 Infinite Elves and Infinite Houses [Code] [Test] 665280 705600
2016 3 Squares With Three Sides [Code] [Test] 1050 1921
4 Security Through Obscurity [Code] [Test] 185371 984
5 How About a Nice Game of Chess? [Code] [Test] 801b56a7 424a0197
6 Signals and Noise [Code] [Test] mshjnduc apfeeebz
7 Internet Protocol Version 7 [Code] [Test] 115 231
12 Leonardo's Monorail [Code] [Test] 318009 9227663
14 One-Time Pad [Code] [Test] 15035
16 Dragon Checksum [Code] [Test] 11111000111110000 10111100110110100
20 Firewall Rules [Code] [Test] 32259706 113
25 Clock Signal [Code] 158
2017 1 Inverse Captcha [Code] [Test] 1047 982
2 Corruption Checksum [Code] [Test] 36766 261
4 High-Entropy Passphrases [Code] [Test] 466 251
5 A Maze of Twisty Trampolines, All Alike [Code] [Test] 372671 25608480
15 Dueling Generators [Code] [Test] 594 328
2018 1 Chronal Calibration [Code] [Test] 522 73364
2 Inventory Management System [Code] [Test] 4693 pebjqsalrdnckzfihvtxysomg
3 No Matter How You Slice It [Code] [Test] 109143 506
5 Alchemical Reduction [Code] [Test] 11668 4652
2019 1 The Tyranny of the Rocket Equation [Code] 3392373 5085699
2 1202 Program Alarm [Code] 3716250 6472
2020 1 Report Repair [Code] [Test] 1005459 92643264
2 Password Philosophy [Code] [Test] 493 593
3 Toboggan Trajectory [Code] [Test] 280 4355551200
4 Passport Processing [Code] [Test] 216 150
5 Binary Boarding [Code] [Test] 842 617
6 Custom Customs [Code] [Test] 6530 3323
7 Handy Haversacks [Code] [Test] 213 38426
8 Handheld Halting [Code] [Test] 1939 2212
9 Encoding Error [Code] 1492208709 238243506
10 Adapter Array [Code] [Test] 2590 226775649501184
11 Seating System [Code] [Test] 2386 2091
12 Rain Risk [Code] [Test] 1533 25235
13 Shuttle Search [Code] [Test] 370 894954360381385
14 Docking Data [Code] [Test] 14862056079561 3296185383161
15 Rambunctious Recitation [Code] [Test] 206 955
16 Ticket Translation [Code] [Test] 22000 410460648673
17 Conway Cubes [Code] [Test] 362 1980
19 Monster Messages [Code] [Test] 151
20 Jurassic Jigsaw [Code] [Test] 68781323018729
21 Allergen Assessment [Code] [Test] 2078 lmcqt,kcddk,npxrdnd,cfb,ldkt,fqpt,jtfmtpd,tsch
22 Crab Combat [Code] [Test] 33434 31657
23 Crab Cups [Code] [Test] 97632548
24 Lobby Layout [Code] [Test] 269 3667
25 Combo Breaker [Code] [Test] 3286137
2021 1 Sonar Sweep [Code] [Test] 1696 1737
2 Dive! [Code] [Test] 1762050 1855892637
3 Binary Diagnostic [Code] [Test] 2967914 7041258
4 Giant Squid [Code] [Test] 38913 16836
5 Hydrothermal Venture [Code] [Test] 3990 21305
6 Lanternfish [Code] [Test] 359999 1631647919273
7 The Treachery of Whales [Code] [Test] 328187 91257582
8 Seven Segment Search [Code] [Test] 288 940724
9 Smoke Basin [Code] [Test] 544 1017792
10 Syntax Scoring [Code] [Test] 319233 1118976874
11 Dumbo Octopus [Code] [Test] 1640 312
13 Transparent Origami [Code] [Test] 671 PCPHARKL
14 Extended Polymerization [Code] [Test] 2584 3816397135460
2022 1 Calorie Counting [Code] [Test] 72240 210957
2 Rock Paper Scissors [Code] [Test] 12458 12683
3 Rucksack Reorganization [Code] [Test] 7878 2760
4 Camp Cleanup [Code] [Test] 599 928
5 Supply Stacks [Code] [Test] JCMHLVGMG LVMRWSSPZ
6 Tuning Trouble [Code] [Test] 1282 3513
7 No Space Left On Device [Code] [Test] 1084134 6183184
8 Treetop Tree House [Code] [Test] 1708 504000
9 Rope Bridge [Code] [Test] 6011 2419
10 Cathode-Ray Tube [Code] [Test] 14720 FZBPBFZF
11 Monkey in the Middle [Code] [Test] 50830 14399640002
12 Hill Climbing Algorithm [Code] [Test] 472 465
13 Distress Signal [Code] [Test] 5825 24477
21 Monkey Math [Code] [Test] 286698846151845
25 Full of Hot Air [Code] [Test] 2‑2=12=1‑=‑1=000=222
2023 1 Trebuchet?! [Code] [Test] 55386 54824
2 Cube Conundrum [Code] [Test] 2285 77021
3 Gear Ratios [Code] [Test] 529618 77509019
4 Scratchcards [Code] [Test] 23847 8570000
5 If You Give A Seed A Fertilizer [Code] [Test] 462648396
6 Wait For It [Code] [Test] 2269432 35865985
7 Camel Cards [Code] [Test] 250474325

🕯️ Useful commands

  • Check formatting: ./gradlew ktlintCheck
  • Fix formatting: ./gradlew ktlintFormat