Cars follow simple acceleration, braking and random-dawdling rules on a ring road. Watch phantom traffic jams form from nothing — the same "stop-and-go waves" you experience on real motorways.
Nagel-Schreckenberg model: accelerate if gap ahead is large, brake if it's small, randomly slow down. These simple rules reproduce real traffic phenomena.
Adjust car density and dawdling probability. Watch traffic jams appear, propagate backward (upstream) and sometimes dissolve. High density creates persistent congestion.
Phantom traffic jams travel backward at about 20 km/h — the speed of the "jam wavefront". Japanese researchers reproduced this with cars on a circular track in a famous 2008 experiment.
This simulation runs the Nagel–Schreckenberg model, a discrete cellular automaton in which a road is divided into cells and each cell is either empty or holds a single car carrying an integer speed from 0 to a maximum. On every time step each car applies four rules in turn: accelerate by one, brake to the gap ahead, randomly slow by one with a fixed dawdle probability, then advance. From these trivially simple local rules realistic stop-and-go waves and phantom jams emerge with no accident or bottleneck required.
It evolves a one-dimensional cellular automaton on a periodic (ring) road with one to four lanes. Each step performs the four NaSch rules — accelerate, brake to the forward gap, dawdle, move — and colours cars from red (slow) to green (fast). A live panel plots average speed over time, and counters report flow in cars per second and mean speed.
Use Pause to stop or resume the update and Reset to repopulate the road. The Density slider (5–80%) sets how many cells start occupied, Max.V (1–8) caps the top speed in cells per step, and Dawdle p (0–0.50) sets the random braking probability. The Lanes dropdown picks 1–4 parallel lanes.
The dawdle term is essential: with zero randomness the same density settles into smooth steady flow, but even a small dawdle probability lets tiny perturbations grow into self-sustaining jams that drift upstream — much like real motorway congestion that forms with no visible cause.
It is a minimal cellular-automaton model of single-lane traffic introduced in 1992. The road is split into equal cells, each holding at most one vehicle with an integer speed, and the whole system advances in synchronised time steps. Despite its simplicity it reproduces the transition from free-flowing to congested traffic.
For each car the model first accelerates it by one up to the maximum speed, then reduces its speed to the number of empty cells immediately ahead to avoid a collision, then with the dawdle probability reduces speed by one to mimic imperfect driving, and finally moves the car forward by its resulting speed. All cars are updated in parallel each step.
Density sets the fraction of cells initially occupied, so higher values pack more cars onto the road. Max.V is the speed limit in cells per step, controlling how fast free-flowing traffic moves. Dawdle p is the probability that a car randomly brakes on a given step, which is the source of spontaneous jams.
It is a deliberately abstract model rather than a faithful vehicle simulator, using discrete cells, integer speeds and synchronous updates. Even so, it captures genuine emergent behaviour: a fundamental diagram with free-flow and jammed branches, and backward-travelling stop-and-go waves that match observations of real traffic.
At sufficient density the road is near its capacity, so when the random dawdle rule makes one car brake, the car behind must brake harder, and the disturbance amplifies as it passes back along the line. The result is a jam that sustains itself and moves upstream even though no crash or bottleneck exists.