day 14
parabolic reflector dish
approach
there is only one tilt, to the left: every row is split on #, and each chunk is rewritten with its Os moved to the front. tilting in other directions rotates the grid in place, tilts left, and rotates back. the load is each row's count of O times its distance from the bottom.
part 1 tilts north once. part 2 runs spin cycles (north, west, south, east), storing every grid as a string in a dict, until a grid repeats. that gives where the loop starts and its length, so it only runs the start plus (1000000000 - start) % length more cycles before measuring the load.
the trick
the spin cycle repeats quickly, so skip ahead to the billionth state with a modulo.
python
def part2(grid):
i, j = cycle_length(grid)
for _ in range(i):
grid = cycle(grid)
for _ in range((1000000000 - i) % (j - i)):
grid = cycle(grid)
return support(grid)