r/Kotlin • Kotlin-team • 3d ago

Advent of Code Project Template

Last year I tried solving (most of) the advent of code challenges in Kotlin Notebook https://www.reddit.com/r/Kotlin/comments/1pe252t/solving_advent_of_code_in_notebooks/ but since they sadly have been sunset, this year I created (read "collaborated with AI") a template repo for you to get started. It has some cool functions I missed from %use adventOfCode in notebooks like submitting answers, waiting for the next day to release, etc.

Let me know if you have any improvements (or make a PR :p)

https://github.com/Jolanrensen/advent-of-code

(P.S. Seb is also doing livestreams again this year! :D https://www.youtube.com/watch?v=Z2kajEnLf3k&list=PLaREJ9wqJKLI )

7 Upvotes

2 comments sorted by

2

u/balefrost 3d ago

My per-day file template is very stripped-down:

object Day01Part01 {
    @JvmStatic
    fun main(args: Array<String>) {
        val input = readInputLines("inputs/day01.txt")
        val result = ...
        println(result)
    }
}

object Day01Part02 {
    @JvmStatic
    fun main(args: Array<String>) {
        val input = readInputLines("inputs/day01.txt")
        val result = ...
        println(result)
    }
}

It makes it easy to run just part 1 or part 2.

I didn't ever get around to automating submissions. I understand the natural draw to automate everything, but in practice I never saw the value unless you're competing on a leaderboard and seconds matter.

None of this is meant as a criticism of what you built. It's just interesting to see so much infrastructure. My infrastructure is just "a utils.kt file" at the moment.

https://github.com/balefrost/adventofcode2026-kotlin/ if you're interested, though I don't think you'll find it very interesting.

2

u/Humpsel Kotlin-team 3d ago

That also works :) there's no wrong way to do AoC after all ;).

For me, I liked the idea of not having to copy paste the input file and let the framework fetch and cache it. I also always parse the input first, so I baked that into there too. Then submitting is just a logical next step. Plus creating libraries is fun, right? :)