AoC 2022 Day 9: Ropeinator

Source: Rope Bridge

Part 1

Simulate two connected links such that whenever the first link (head) moves, the tail moves to follow according to the following rules:

  • If the tail is at the same location as head, don’t move
  • If the tail is adjacent to the head (orthogonal or diagonal), don’t move
  • If the tail is in the same row/column as the head, move one directly towards it orthogonally
  • If the tail is in neither the same row nor column, move one towards diagonally

Count how many unique spaces are visited by the tail of the link.

read more...