| Algorithm 1. Importance of social distancing by flattening the curve of afflicted population over specific days | |
| Step 1: Initialize necessary parameters as follows to create a simulated town infected with COVID-19 – | |
| days = 100/*lockdown days*/ | |
| population = 200,000/*population of the town*/ | |
| spread_factor = 0.25/*COVID-19 transmission rate (0 < f ≤ 5) */ | |
| days_to_recover = 10/*maximum recovery days from COVID-19*/ | |
| inital_afflicted_people = 5/*initial infected people of the town with COVID-19*/ | |
| Step 2: Initialize a data frame (“town”) for the simulated town with the following four features – | |
| id = range(population)/* id € (0- population) */ | |
| infected = false | |
| recovery_day = none | |
| recovered = false | |
| Step 3: Initialize the initial cases (“initialCases”) with inital_afflicted_people variable, | |
| update corresponding infected feature as true, and | |
| update recovery_day feature with days_to_recover variable | |
| Step 4: Initialize the initial active cases (“active_cases”) with initally_afflicted variable and | |
| initial recovered cases (“recovery”) with 0. | |
| Step 5: | |
| for day = 1 to days do | |
| Step 5.1: Mark the people of town data frame, who have recovered on current day | |
| - update the feature recovery_day as True and infected feature as False | |
| if they have crossed days_to_recover else ignore. | |
| Step 5.2: Calculate the number of people who are afflicted today with spread_factor | |
| - calculate number of people infected in the town data frame based on | |
| feature infected = True | |
| -multiply the count of total infected people with spread_factor to | |
| calculate total possible cases of infected people on current day | |
| Step 5.3: Forget people who were already infected in cases of current day | |
| Step 5.4: Mark the new cases as afflicted, and their recovery day by updating | |
| active_cases and recovery lists of the town data frame. | |
| Step 6: Repeat the step 5 for spread_factor = 0.25 to 5.0 and plot every distribution graph of active_cases over days. | |