Social distancing simulator

This simulator allows you to interactively explore the effects of social distancing on the spread of any contagious disease. Each circle represents a person who can be either healthy (white), immune (yellow), infected (red), or deceased (gray). A healthy person is infected when they collide with an infected person. After a period of infection, a person either dies or become permanently immune.

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

Social distance 10%
Mortality 3%
Infection duration 2.0s
healthy immune sick deceased time
% % % % s

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

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

Infection duration determines for how long a person is infected. A longer time gives an infected person more opportunities to spread the infection. Since the simulation runs at high speed, time is measured in seconds.

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 of the simulation is Andrej Bauer. The idea for it came from an article in the Washington post written 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 during an epidemic in terms of an artificial mathematical model. It should not be used to draw any conclusions about real contagious diseases.