david meissner


Pandemic

Refresh the page in order to restart the simulation.

This sketch is an unscientific simulation of a pandemic, inspired by current events. I wrote the original of this a few years ago and recently converted it to p5js.

The simulation starts with 150 “walkers” and one infected walker. The infection and recovery factors are hard-wired, but I’d like to add a UI that allows for adjusting the simulation.

Each walker starts out with a random immunity factor. When a walker encounters an infected walker, the walker may get infected depending on their current immunity factor. The walker will remain infected for a random duration, and then will either get well, or will die.

If the walker gets well, their immunity factor will increase, but they can still get infected again if their immunity is less than the maximum. If a walker survives a couple of infections, they should be completely immune.

The fatality rate is set at 30%; there is a 30% chance that an infected walker will die, regardless of their immunity factor.

It can happen that the first infected walker either dies or gets well before infecting others, but most of the time the simulation proceeds as expected and about a third of the original population dies.