BohdanQQ

Advent of Code inspiration: Day 17 pt. 2

Day 17 has brought a surprise to me. AOC always seemed a bit monotone but this year's day 17 part 2 made me change my mind. Here is some inspiration from some people's solutions.

Monotone

My general feel for AoC has been thus: it's one of a few types of assignments and if the assignment is more complex than just utlizing algorithms, you just need to know that one theorem that will solve the task for you in a blink of an eye.

This year (2024)

This year's day 17, your task is to interpret programs. In part 2 however, you are supposed to find a parameter that makes the program output itself during interpretation.

First, I discovered 2 ways to compute this parameter (apart from brute-forcing):

Going from the front and from the back of the bit-representation of the parameter. My solution was designed by attempting to progress towards most significant bits (octets to be precise) and backtracking from the least significant bits/octets. I also tried to comment on the discovery in detail so feel free to check it out! (don't be too critical of the solution, I tried to not get trapped in simple typos/errors so I opted for the representation that you can see there. It runs in ~290us so it is not that bad)

Then I checked out reddit and some people I follow on GitHub and I discovered the following:

These approaches made me feel a bit refreshed about Advent of Code, especially since this year's puzzles seemed to be a bit too easy so far.

Last update

17th December 2024