Share your repls and programming experiences

← Back to all posts
Simulator of Spread of COVID-19
adhvaiththurvas (29)

Hi guys,
This is my first post. I was looking at the news (with coronovirus spreading and mass panic ensuing) and decided to make a little simulator of the spread of coronavirus based on infectivity rates and mortality rates. This isn't complete, I'm still adding stuff to this to make it more accurate, but it's pretty good for now. Hope you guys enjoy it!


Good job! One thing I would recommend is to remove using namespace std;, as that is a bad practice

AphixDev (211)

@TaylorLiang It's not really a bad practice in replit. I'd say, having experience in UE4 and Unity, that it is most important to remove in software development and Game Dev, but otherwise, it's a nice thing to have for time's sake.


@nt998302 for something small, I would agree that yeah, its ok. Just that for larger projects, it can cause a hassle and errors later on

Heavilyass (0)

I hope that everyone is doing fine here. That pandemic sucks… But still we have some positive sides. Most of us can work remotely. Personally, I prefer to stay at home in my cozy room and work from my bed rather than the office with noisy colleagues in a hot as hell conference room. During lockdown, I managed to dedicate some time for my self-development and read 100 books, do yoga and update my playlist. Despite the fact that my test at showed me that I am ill now, I like the way my life goes up and up. And I wish the same for you guys!

ChezCoder (1607)

your feedbak thing doesn't work, clients cant change your server sided text files. it can easily solved with database packages or a database handling lang. (php, nodejs, etc...)

SilentShadowBla (555)

C++ should be used more, this is awesome

Mapaor4 (4)

How do you program the Try again button?

Mapaor4 (4)

@SilentShadowBla Hey, I can't see the loop. The main funcion ends with simulation(people,day,num_of_ppl);

and at the end of this function we found:

cout << "Any feedback? (Must be 1000 words or less)" << endl;
    char feedback[1000];
    cin >> feedback;
    file << feedback << "\n";

So where exactly is the loop?

adhvaiththurvas (29)

@Mapaor4 the while loop is in the function simulation (vector<int> a, int day, long long int num)

Mapaor4 (4)

It's easy to win but really good code

adhvaiththurvas (29)

UPDATE: COVID-19 Simulator is now updated to 0.0.15 (Fuschia)

  • age is now a factor in the pandemic. There are a bunch of old people with twice as high of a mortality rate.
  • the objective is to get under a 3% mortality rate and try to get rid of the pandemic as quick as you can.
  • a few more features to make this more game-like

FUTURE: more features to be added, including the socio-economic effects of the COVID-19 pandemic and means of decreasing the mortality rate

AgastyaSandhuja (170)

I spammed "3" and won the game so you should add things to stop a spam for something that can easily win the game

adhvaiththurvas (29)


  • fixed bug where simulation wouldn't stop when no one is infected
  • increased "mass panic" threshold
    The infectivity rate is based on real stats, as well as the mortality rate. I am working on increasing the mortality rate.
    This is meant to be a simulation of a real COVID-19 pandemic, which is why I am adding more features, and why the infectivity rate/mortality rate isn't as high.
LiamDonohue (295)

i just did nothing the whole time lol

LiamDonohue (295)

It's like but for COVID

LizFoster (640)

It's a little bit too easy to win. Also, it doesn't automatically stop when the number of infected people hits zero. Maybe make the infection rate twice as high, or something like that? This is a very good idea, and well thought out if I may. Good work so far!