day 25
sea cucumber
approach
two herds of sea cucumbers move on a grid that wraps at the edges: first every > that has a free cell to its right moves, then every v with a free cell below. each half-step reads from the old grid and writes to a copy, so they all move at once. the loop counts steps until nothing moves.
day 25 has a single part; the second star comes from finishing the others.
the trick
move each herd from a snapshot of the grid, so a cucumber can't move into a cell another one just left.
python
def step(grid):
m1, grid = step_horizontal(grid)
m2, grid = step_vertical(grid)
return m1 + m2, grid