How it works
A closed chain of nodes is under three forces at once. A spring holds each node at a set distance from its two chain neighbours. A second, weaker pull draws it toward the midpoint between them, which rounds off kinks. And every other node within a given radius — chain neighbour or not — pushes it away. The repulsion radius is set well above the spring length, so the line can never lie alongside itself closer than that, and that one number is what sets the gap between every fold in the finished piece.
None of that makes anything happen on its own. On an even ring the repulsion from the two neighbours cancels exactly and the chain simply sits there. Growth is the driver: every tick a fraction of the edges is picked at random and split at the midpoint, so the chain gets longer while the sheet it lives on does not. Folding is the only way to absorb the excess, and the fold spacing is fixed, so the pattern is forced.
Two failure modes are worth knowing about, because both were built and fixed here. A pull-only spring lets repulsion stretch an edge into a chord straight across the drawing; the spring has to push as well as pull. And a repulsion radius larger than the spring length applied to chain neighbours makes every edge split forever, so neighbours are exempt from repulsion and the springs handle them instead. Seeding from a wide ring rather than a tight one gives a clean annulus; a tight seed leaves a compressed core, because that material folded when the loop was still small and can never get out again.