🎄⌨️ Advent of Code 2018

Tech-note 78a3a0

Day 12: Subterranean Sustainability

I was pretty proud of myself in that I grasped the weird parts of this problem correctly, where seemingly many people stumbled on the wording a little. Specifically, early on I realized that the challenge was that the spread of planted pots would expand slowly at both ends, and that there needed to be some way of keeping track of the left end specifically. So I was getting correct answers for part 1 pretty quickly.

I'm a little less proud that I went to the megathread to get help with solving part 2 when I could have done it on my own. Initially I tried just setting the function to 50,000,000,000th generations and letting it rip, but that obviously took too long. Then I did look for a pattern in the output, but I only looked at the first 20 generations, and could not discern one. If I had looked at the first 100, I would have got the answer on my own! But at that point I thought, well there's no pattern so it's probably some mathematical jiu-jitsu that I need to learn, I'm just going to go at least get pointed in the right direction. Alas, there was no special math involved; there is an extremely obvious pattern in the numbers that starts somewhere around generation 90, depending on your input. If I’d have looked a little longer I would have found it myself.

But I’m not going to beat myself up about it, because I’m somehow still in the game and I’m still enjoying it, despite having very little time to devote to it. This is also the furthest I’ve gotten in the Advent of Code event! I really think I might have a shot at finishing this year, even if there's no hope of solving all the puzzles by end-of-day Christmas.

day12.rkt

Other thoughts:

  • I can’t imagine the effort that must have gone into designing this puzzle. It’s extremely clever. In particular it seems weird and serendipitous that a set of rules could be found that would cause the number of planted pots grows linearly only after 90 generations. In general I’m intrigued by the fact that not only does Eric Wastl have to design the puzzle, it has to have valid and unique solutions for a nigh-infinite number of input values.
  • I am getting a little tired of the pattern where Part 1 is straightforward and easy to solve, and Part 2 basically entails a demand like “now do the same thing fifty billion times”. But I learn a lot from problems like this, and these are in fact the kinds of problems real programmers have to deal with.