board · 920 × 196grid · on
Why do highways jam with no accident in sight? Nagel and Schreckenberg's 1992 cellular automaton showed that three rules — accelerate toward a speed limit, never outrun the gap ahead, and occasionally brake at random — are enough to make phantom traffic jams condense out of smooth flow.
Here each car checks the cells in front of it with a coordinate occupancy lookup, clamps its speed to the open gap, applies a stochastic slowdown, and rolls forward on a wrap-x ring road. Above a critical density the random hesitations stop being absorbed and lock into jam waves that drift backward against the direction of travel; the speed-colored cars make the shockwaves easy to follow.
