Pandemic Simulator
31 Mar 2020
This was a collaborative project I did with my siblings. It's a bit late to the game in that there are already many other better pandemic simulators out there. But that being said, this was more an exercise in programming than anything else.
The canvas below represents either a town, a city, a district or even a whole country. This "world" is populated by "Blobs" and like every other world consists of population centers.

A Blob is a stand-in for a human. It has two characteristics (or properties). A size and an infection radius. I am going to go out on a limb and assume that these are self explanatory terms. A human travels from his "home" location to a population center and back home each day.

A Population Center is a stand-in for somewhere humans go to during everyday of their existence. It could be a school, a workplace, or even a movie theatre. Population centers of of two types.

At the start of every simulation only one Blob is infected. Everytime this Blob comes within the infectivity radius of another Blob the infection spreads.
Infections also have a fatality rate. A higher fatality rate results in the Blob "Dying" sooner.
It is also possible to socially distance Blobs. To our surprise this indeed results in the more Blobs "Surviving".

Each parameter is controlled with sliders below the simulation. We were most surprised with controlling the Social Distancing Complaince Rate slider. Social Distancing isn't supposed to curb infections; it only slows the infection rate at a rate which hospitals can cope up with. And this is exactly what happens in the simulation.

Sorry, your browser does not support Canvas.
VariableValue RangeValue
Population Density50 - 500
Blob Size 2 - 10
Infectivity (R0) 1 - 20
Social Distancing Complaince Rate 0 - 100
Fatality Rate 0.01 - 1
Presets




1. infection.js - Download, index.html
//Code goes here

Javascript Demos

Here's a bunch of javascript... things I wrote over the years whenever time permitted.