Simon’s Corona Epidemic Simulation Code Along Project

At the beginning of April, Simon started working on his COVID-19 epidemic simulation project, implementing a number of scenarios (like various degrees of hygiene, quarantine, social distancing), explaining his code live on camera so that anyone can code along and create their own simulations.

Simon first started creating this project in p5.js (JavaScript) but quickly switched to Processing (Java). His code is available for download on GitHub at:

The programming language I used is Processing (Java), optimized for Creative Coding purposes. To run the code on your computer, you’ll need to install Processing (I provide more detailed instructions in my GitHub readme).

My basic coronavirus simulation in p5.js:

the spread of the virus and recovery
increased hygiene and quarantine
two social distancing scenarios

The project is still in progress, as Simon plans to implement a few more realistic scenarios. He recorded Part III live on Discord (The Coding Train’s Discord channel) and will probably do the same for the upcoming parts, so stay tuned!

Simon sketching while thinking the simulation through. The green, pink and blue circles say: susceptible, infected, recovered.
During his initial attempts to create the simulation in JS from scratch, Simon turned to these wicked algorithms and applied them correctly (as his peers told him reviewing his code), but the code produced chaotic results. He later switched to Java as he remembered one of the build-in examples in Processing could serve as the basis for dots colliding.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s