Social distancing simulator

With this simulator you can explore interactively the effects of social distancing on the spread of a contagious disease. Each ball represents a person who can be healthy (white), immune (yellow), sick (red), or dead (gray). A healthy person becomes sick when it collides with a sick one. When a sick person survives the infection, it becomes immune.

Move the sliders to change the parameters and observe what happens. A detailed explanation is available below.

Social distance 10 % Mortality 3 % Sick time 2.0 s

○ healthy ● immune ● sick ● dead time % % % % s

Social distancing controls to what extent the population enforces social distancing. At 0% there is no social distancing and the persons move with maximum speed, so that there is a great deal of contact between them. At 100% everyone stays still and there is no contact at all.

Mortality is the probability that a sick person dies. If you set it to 0% nobody dies, while 100% mortality means that anybody who catches the disease will die.

Sick time determines for how long a person is sick. The longer the time, the more opportunity the person has to spread the infection. The time is measured in seconds because the simulation runs very fast.

The simulation purposely makes a number of simplifying assumptions, among them: there is no incubation period; persons are contagious for the entire duration of their sickness; and the probability of passing the infection through contact is 100%.

The author Andrej Bauer got the inspiration for the simulation from a Washington Post article by Harry Stevens. The source code is freely available as a GitHub project social-distancing-simulator . Please help improve the code and translate it into your language.

See this page in other languages.

Disclaimer: The purpose of the simulator is purely educational. It demonstrates the complexity of social distancing in an epidemic in terms of an artificial mathematical model. It should not be used to draw any conclusions about real diseases.