This applet demonstrates the simulation of traffic flow by cellular automata. You can choose between update rules according to the models by Kai Nagel and Michael Schreckenberg , by Robert Barlovic, Ludger Santen, Andreas Schadschneider, and Michael Schreckenberg, or by Dirk Helbing . The density can be adjusted within reasonable limits.
Red regions indicate congested traffic.
As the vehicles move to the right, the jam waves propagate backwards in space. Below, one can see a picture of the simulated road with periodic boundary conditions. You can download the source code of this applet written by Kai Bolay .