Skip to content

The Advent of Code 2022 Day 6 log: signals everywhere

Posted in Advent of Code

For today’s puzzle I mentally prepared to take on something trickier. What does that Eric Wastl trickster has in store for us today? Are we about to enter a world of torture? Let’s jump right into my Advent of Code 2022 Day 6 cruising log to find out.

While reading the problem statement, I felt like the difficulty went a tad down so I got comfortable. But before getting comfortable, I was so prepared for pain that I went for the trickier implementation from the get-go. I did so because generally, by day 6 we get a taste of the pain to come in the latter days. This could have been my downfall if I hadn’t written parametrized tests to validate all of the examples from the start. But I did.

That initial failure made me realise something. In programming have that thing called KISS. Keep it simple stupid. This allowed me to see right through everything. I went too fast and too furious coding this solution so I had to take a step back.

Right away I wrote the dumbest possible implementation and all the tests passed. From there I ran the input through the code and expected some sort of optimisation issue that would hang the code but nope. It instantly yielded a result that granted me the first star of the day. This took me aback as I expected more resistance here. I am not one to look in a gift horse’s mouth so I just kept going.

Surely, the difficulty would pick up and make me regret my implementation choice. After all, it’s not even 5.20 am and I’ve been through two implementations that weren’t the brightest. I’m reading through it and the second part is the first part with one parameter to adjust.

After updating my code, I wrote the tests for that second part and they all went green instantly. From here I run the input against that solution and capture my second star of the day. Maybe it was easier than I thought. Maybe I shouldn’t have doubted so much for that today is a gift.

Thank you for reading my Advent of Code 2022 Day 6 log, I will see you tomorrow. If you want to check out my previous entry, you can do so there. You can even read my entries from last year there. As usual I will push the code to my repo for this year on Github.

Cover by Igor Mashkov

Be First to Comment

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    %d bloggers like this: