Hello elves and other kinds of midgets, another early morning another puzzle. Today we deal with compartmentalising things, not feelings which one cannot simply control. At least not others’ unless we put them into rucksacks. Another thing you can do is enjoying this Advent of Code 2022 Day 3 cruising log.
Woke up at 4.50 am as I have for the past couple of days, brain still fuzzy as I write this. And yet, that puzzle felt slightly less confusing than the last. Maybe my brain is getting used to this rhythm. Went to bed quite late after the Cameroon historic win over Brasil so I got very little sleep. Fortunately France plays tomorrow afternoon so this won’t be a problem for day 5.
Today, I read the problem statement a couple of times and I feel like I got the gist of it. Yet, somehow, the first test run was red. I debugged the code a couple of times and for some reasons I never reached the code I was going for. Because my test class still referenced the Day1 class instead of Day3. Once I sorted that out, I ran the test again, still red.
This time, I split my strings the wrong way so after some flash-like debugging I fixed this bug easily. From there it was smooth sailing onwards. I caught my first star of the day and in a breath read the second part of the problem. As I started to figure what I had to do, I realised that I already wrote all of the code and simply had to shift my mind a bit.
By that I mean that the second part of the problem defined things with a different name, but they can be solved in the same way as the first. Well, if you designed the first part of the code in a sound manner. Since I did, I could simply reuse every method I already wrote and the test went green right away. I ran it a couple more times for certainty’s sake and it still passed.
At that point, happy with myself, I run my input through the code, then submit my answer and voila. Star number two embraces me and I can finally go
back to sleep write this post.
Thank you for reading my Advent of Code 2022 Day 3 log, I will see you tomorrow. As usual I will push the code to my repo for this year on Github.
Cover by Pavel Danilyuk: