Member-only story
In my last post I carried out a code review of John Conway’s Game of Life, which is a zero person animated game. The link to that post can be found here:- https://tracyrenee61.medium.com/playing-conways-game-of-life-on-replit-4591ab603149
I have been so impressed with the animations that matplotlib can carry out that I searched for another type of animation, which is a simulation. In this post I intend to carry out a code review of a virus spreader, which also uses matplotlib to animate the spread of a hypothetical virus. I found the code for the virus spreader in a YouTube video entitled, “Simulating COV19 Using Python, Numpy and Matplotlib”. I was unable to get the program to run on Google Colab, being the interpreter that I normally use, but I was able to run it satisfactorily on Replit.
I am totally new to making simulations, so I can only carry out a code review at this point in my programming education. The code review is as follows:-
- Import libraries, being numpy and matplotlib.
- Assign values for colours, being grey, red, green and black.
- Set up the parameters for COV19.
- Define class Virus.
- Define __init__ function.
- Define initial population of 4,500.