Stream: advent of code

Topic: Day 9


view this post on Zulip Kevin Gillette (Dec 09 2022 at 08:26):

If you get stuck on day 9, carefully reread the movement instructions:

If the head is ever two steps directly up, down, left, or right from the tail, the tail must also move one step in that direction so it remains close enough.
Otherwise, if the head and tail aren't touching and aren't in the same row or column, the tail always moves one step diagonally to keep up.

I had mis-inferred that the tail knot should merely go where the head knot had previously been whenever they're too far away. That turns out to be entirely equivalent in effect to ^^ for part 1, but doesn't work at all for part 2. I find it hard to locate (or even notice) instructions in diagram-heavy puzzle days like this one, so spent about 90 minutes just trying random stuff before carefully rereading.

view this post on Zulip Shritesh Bhattarai (Dec 09 2022 at 15:49):

Here's my day 9. I'm sure I would have given up between part 1 and 2 if I didn't have a type system to guide me through the refactoring.

view this post on Zulip Luke Boswell (Dec 10 2022 at 06:24):

Here is my Day 9 solution. I really enjoyed this one. :smiley:

view this post on Zulip Ayaz Hafiz (Dec 11 2022 at 22:21):

My day 9. I also thought this was a fun one


Last updated: Jul 06 2025 at 12:14 UTC