Virus Spread Simulation

Due to the coronavirus/COVID-19 I had some time at home and I made use of it. So I’m proudly presenting my virus simulation app. The app starts with 20 persons, represented as dots, on your screen. At first, only one person is infected. But as the virus spreads, more people get infected. The app uses color coding for easy recognition. Green means healthy, red means infected, yellow means revered and black means dead. You can tune parameters such as infection distance and infection rate on a separate screen and watch how the growth of the virus changes.

Note: The results of the app are not comparable as the parameters are unitless and the model is very rough. The infection state could be modeled in more detail. The movements are random at the moment and I hope that the error will be normally distributed in that way. Also, the size of everything on the canvas depends on your screen size and resolution.

virus.aia (21,4 KB)


Thank you for sharing this. Would you be interested in submitting this for the App of the Month so we can give it some publicity?

Also App Inventor recently launched a Coronavirus App Challenge

and we are encouraging inventors like yourself to generate gallery links and share at Twitter with hashtag: #AppInventorCoronavirusChallenge

Thank you
Selim Tezel
MIT App Inventor, Education Team


The Washington Post has done similar simulations, see Another simulation can be found here

Hi, Red Panda. That is a nice app you made!
Because I was just finishing a very similar app, I took a closer look. My app is more modest and simpler, it just tries to explain that social distancing helps a lot to beat the virus. I do not want to hijack this tread, therefore I will attach mine to another thread.
I just would like to remark a few things on the code.

Your Settings screen is good, nice lay-out!
I did not like so much the partial disabling of blocks, this was hardly necessary considering the amount of blocks.
Your color abstraction is good (I changed my app accordingly)

I think you should change your “components” procedure, because the list would be built every time you need it. Since a few releases ago you can also define your list like this:

I am not really sure you need the notAlreadyHandled switch in the when any… blocks, because you do not have any spefic ball events. But then… I cannot find the documentation about it.
My 2 cents.
Nice work! Cheers, Ghica.

Hi, thanks for your remarks on my code. Let me adress them one by one

The disabling was necessary to indicate that the Spinner.AfterSelecting block is not working for me. The spinner component has changed a lot since I used it last time, now it is more like a radio button instead of a dropdown.

Is that the case? Because I normally do constants like this
and variables like this

I am talking about this one:
Cheers, Ghica.

The app is PNAMBIC
It lets you play 2 movies.

Where’s the code for the real simulation?

Please do not hijack this thread. Your app has nothing to do with mine

There is no such intention at all, but I deleted it all.

Hi, where is the part that indicates/counts how many infected peaple there are in the blocks. Or did you not do that?