Supermarket Simulation Shows the Importance of Social Distancing to Contain Covid-19 Spread

An interactive supermarket simulation showing how important social distancing is for containing the spread of Covid-19

Agustinus Nalwan
6 min readApr 13, 2020



There is no doubt that Covid-19 has spread like wildfire and wreaked havoc on our lives. In just four weeks, our way of life has become very different from what it used to be. To stop the spread of the virus, countries are imposing preventative measures. The majority have closed their borders, internationally and state-wide, and many others such as Australia and New Zealand have imposed a lockdown, closing non-essential businesses and venues such as cinemas, pubs, restaurants, parks and playgrounds. Only essential businesses like supermarkets, childcare facilities and chemists can remain open.

All of these measures impose a strategy called social distancing, a term we may not have heard until just a few weeks ago, thanks to Covid-19.

Social Distancing

Social distancing refers to efforts to avoid direct or close contact with a person while they are infectious. Because some who are infected do not show symptoms, we should assume that everyone is contagious. For example, when you are at the supermarket buying groceries — which is practically the only reason I went out in the past three weeks — you should maintain a distance of at least 1.5 metres from others. This is crucial because the virus can spread from water droplets expelled when breathing, sneezing or coughing. Hence, the closer you are, the higher your chances of infection.

Social distancing — 1.5m safe distance between each other

In order to better understand and do my part by encouraging others to see the importance of social distancing practices, I built an interactive simulation using JavaScript and a matter.js physics engine. It uses a particle system to simulate two levels of social…