This is just a simulation, a quick model, not reality. Just balls, not people. This simularion can give different results with different screen sizes as well as the randomness of infections, movements, and so.
Balls can get infected by a custom virus. These balls has several states:
- Balls can be healthy with no present or past virus. (light blue)
- Balls can also be incubating the virus, this would be present and can infect other balls by touching them. (dark blue)
- Balls can be infected (better call them ill). They can infect other balls, can heal or die. (red)
- Balls can be healed when the virus is gone. But the ball had the virus in the past. (green)
- Balls can be deceased when the virus kills them. (black) Deceased balls don't interact with other balls anymore, keep moving but losing speed until they stop, but as ghosts they can go through other balls.
The virus can infect other balls with certain probability, if some ill balls hit each other the viral load increases, increasing probabilites of fatal ending.
We can mitigate the effects stopping balls population, as you may imagine stopping all balls would be the better case. Infected balls can't touch any other ball so ill balls can heal or die without contagion. But we can choose 90% of stopped balls to see some results.
There are many things this thing doesn't do:
- Ill balls continue, it should be great if some red balls could be isolated
- General population isolation
- Healed balls can't infect other balls as some viruses do
- Healing should be more random, not at X days
- Sometimes, when speed is too fast or there is too much frame dropping, balls do strange things, they overlap with other balls keep touching again and again. :S
This is just a fast and tiny project inspired by: Washington Post's Corona Simulator. Using some hysics notes when I came across BallsBallsBalls to mitigate the overlapping problem, could not fix it but found some things to improve movement and collisions. Also started using some code from Bouncing balls from MDN.
You can visit my blog Poesia Binaria in Spanish, about programming, security and system administration. I also have a little website with some projects. You can also find me on:
Fork me on GitHub