AoC 2024 Day 14: Chaosinator

Source: Day 14: Restroom Redoubt

Full solution for today (spoilers!).

Part 1

Given a series of robots defined with initial position and velocity on a 101x103 toroidal grid, calculate where the robots will be after 100 iterations. Return the product of the number of robots in each quadrant of the final grid, ignoring the middle lines (since they’re odd).

read more...


AoC 2024 Day 9: Defraginator

Source: Day 9: Disk Fragmenter

Full solution for today (spoilers!).

Part 1

Given a disk layout alternating between files and empty spaces, move all files as early on the disk is possible, splitting into multiple blocks. Return a checksum on the disk.

Alternating means: 23331 would mean a 2 block file, 3 empty, a 3 block file, 3 empty, and a 1 block file.

The checksum is the sum of file_id * block_index for all occupied blocks. File IDs are assigned sequentially on initial generation.

read more...


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...