Code and Gravity

Why does the ball take so long to escape the rings?

The ball can only leave a ring when the gap is in the right place at the moment the ball arrives. The gap covers a small part of the ring and keeps spinning away, so the ball often bounces back and has to wait for the next chance.

The gap is small

In our five-ring simulation the innermost ring has a gap of 75 degrees out of 360. That is about 21% of the circle. Outer rings have smaller gaps, down to 42 degrees (about 12%).

The ring keeps spinning

The innermost ring turns 0.011 radians per frame, which is about 38 degrees per second at 60 frames per second. One full turn takes roughly 9.5 seconds. Each ring spins at a different speed and some spin the opposite way, so gaps never stay lined up.

Why bouncing makes it harder

The ball only escapes if it reaches the wall inside the gap, with enough room for its whole width. A ball that hits the wall just beside the gap bounces back inward and has to try again. The ball then has to wait for the gap to come around again.

Why every run is different

Where the gaps start and how the ball is launched depend on the random seed. A different seed changes the escape time, which is why we choose seeds so the final escape lands near the end of the video.

Questions

Does the ball always escape?
Eventually, yes: the gap passes every direction of the ring over time. The question is how long it takes.
Why do more rings take longer?
The ball has to escape each ring in turn. Each ring adds its own waiting time, and outer rings have smaller gaps.

Try it: open in the sandbox →

By Code and Gravity · 2026-10-23

More to learn