close menu
Kotlin logo on festive background

The Most Wonderful Time of the Year


02 Dec 2021


Or something... While I'm not a fan of the omnipresent Christmas music and rampant consumerism that has been inescapable since about November 12, December is finally here and the holidays are hitting hard and fast! When I was kid, every December my parents would get me one of those advent calendars filled with chocolates to get me hyped up (on sugar) for the Christmas season. I don't usually get those anymore, but I still keep up the tradition with a different kind of advent calendar... It's officially Advent of Code! Christmas is endanger once again, so every day of December up until the 25th there will be a new holiday themed coding puzzle available to tackle. Let's get to work!

This year I'm writing and publishing my solutions in Kotlin, 1 and I'm also golfing them

While it may seem crazy to pick a Java-adjacent language for code golf, 2 Kotlin is probably my favourite programming language, and I'm confident I can get some good scores.

AoC problems usually have two parts. For each problem, here's what I'm aiming to accomplish this holiday season:

  1. Write an idiomatic solution which solves both parts as DRY-ly as possible.
  2. Golf a solution (including parsing inputs) that solves both parts using only a single source file.
  3. Try not to be last place on my friend's leaderboard.

Follow along on GitHub at https://github.com/keeferrourke/aoc2021. I have two branches set up:

  • main for idiomatic and legible solutions.
  • golfed for the smallest, correct Kotlin scripts I can write.

Both branches have tests, and I hope that this serves as a nice example for anyone looking to get their feet wet with Kotlin for the first time.

Happy Advent of Code!


  1. There's also some extra incentive from JetBrains. ↩︎

  2. For the curious, JetBrains has a small guide for competitive programming here. Perhaps after this year's AoC I'll have an analogous golfing guide. ↩︎