Source: Spinlock1
Part 1: Start with a circular buffer containing
[0]andcurrent_position = 0. Fornfrom1up to2017:
- Step forward
steps(puzzle input)- Input the next value for
n, setcurrent_positionton, incrementn- Repeat
What is the value after 2017?
It’s a bit weird to describe, but the given example helps (assume steps = 3):
(0)
0 (1)
0 (2) 1
0 2 (3) 1
0 2 (4) 3 1
0 (5) 2 4 3 1
0 5 2 4 3 (6) 1
0 5 (7) 2 4 3 6 1
0 5 7 2 4 3 (8) 6 1
0 (9) 5 7 2 4 3 8 6 1