Victor Kropp

Advent of Code Day 3

The third day required the use of regular expression for the first time this year. The puzzles are progressively harder each day, but I still can solve them during my morning coffee.

The first puzzle required just taking the regexp match result, while the second one was about processing all matches sequentially.

I’ve come up with a simple when for that:

when (command.value) {
    "do()" -> enabled = true
    "don't()" -> enabled = false
    else /*mul*/ -> if (enabled) {
        // add to the sum
    }
}

Today I also had time to convert the project to Kotlin Multiplatform. Originally, I used an Amper template, which runs on JVM. I’m going to evolve it further in the coming days.

As usual, my code is on GitHub: kropp/aoc24. See you tomorrow!



This is post 23 of #100DaysToOffload

Advent of Code100DaysToOffload

Subscribe to all blog posts via RSS