Python new coronavirus epidemic simple simulation program ﹣ Python Wizard module

The first situation:
No paramedics, no safeguards! People walk around,
Soon, all infected with the virus

Red? Amounts = 30? 1. Number of infected
Red dot speed factor

Limes = 300 ා 3. Number of uninfected people
Limeu protection = 0 ා 4. Number of protective measures
Life speed k = 5 5, movement speed of uninfected people

White ᦇ 6. Number of angels in white
White? Speed? K = 0? 7. Movement speed of the angel in white

The second situation:

Without medical staff, 50% of people have protective measures, and people don't move,
It doesn't take long for 50% of people to get infected and 50% of people not

Red? Amounts = 30? 1. Number of infected
Red dot speed factor

Limes = 300 ා 3. Number of uninfected people
Limeu protection = 150 ා 4. Number of protective measures
Live ﹐ speed ﹐ k = 0 ﹐ 5. Movement speed of uninfected people

White ᦇ 6. Number of angels in white
White? Speed? K = 0? 7. Movement speed of the angel in white

It shows that it is very important to have protective measures to avoid infection!

The third situation:

There are 50 medical and nursing staff, and the infected do not move,
100% of uninfected people have protective measures, and people don't walk,
As soon as the medical staff were born, they rushed to the infected people, and soon all the infected people were cured

Red? Amounts = 30? 1. Number of infected
Red dot speed factor

Limes = 300 ා 3. Number of uninfected people
Limeu protection = 300 ා 4. Number of protective measures
Live ﹐ speed ﹐ k = 0 ﹐ 5. Movement speed of uninfected people

White? Amounts = 50? 6. Number of angels in white
White ﹣ speed ﹣ k = 5 ﹣ 7. Movement speed of angel in white

This shows that people are aware of the seriousness of the matter and with the participation of medical staff,
The virus can be eliminated quickly! So this is the situation now, so everyone
Don't worry at all. The epidemic is completely under control!

The following is the Python source code. This program needs the support of sprites module. Please input it in the command prompt first

pip install sprites for installation. If the installation is slow, go to my blog of lixingqing.com to find the installation script

```"""
//A simple simulation program for the new coronavirus epidemic situation
//The red dot indicates the infected person, the green dot indicates the uninfected person, and the white dot indicates the doctor
//The program scheme can be set up by itself, so that different results can appear.
"""

from sprites import *

red_amounts = 30            # 1. Number of infections
red_speed_k = 5             # 2. Red dot moving speed factor

lime_amounts = 300         # 3. Number of uninfected people
lime_protects = 300        # 4. Number of protective measures
lime_speed_k = 0           # 5. Movement speed of uninfected people

white_amounts = 50          # 6. Number of angels in white
white_speed_k = 5           # 7. Movement speed of angel in white

width,height = 500,500
screen = Screen()
screen.tracer(0,0)
screen.bgcolor('black')
screen.setup(width,height)
screen.title('A simple simulation program of new coronavirus')
reds = [Sprite(shape='dot') for x in range(red_amounts)]
for p in reds:
p.scale(2)
p.set_tag('red')
p.speed = red_speed_k * random.randint(1,5)  # Redefine speed
p.gotorandom()
p.gotorandom()
p.color('red')

limes = [Sprite(shape='dot') for x in range(lime_amounts)]
counter = 0
for p in limes:
p.scale(2)
p.set_tag('lime')
p.speed = lime_speed_k * random.randint(1,5)
p.protect = False          # Custom properties
if counter < lime_protects:
p.protect = True       # If you wear a mask, the red particles will not turn into red particles
counter = counter + 1
p.gotorandom()
p.gotorandom()
p.color('lime')

whites = [Sprite(shape='dot') for x in range(white_amounts)]
for p in whites:
p.scale(2)
p.set_tag('white')
rr = random.choice(reds)  # Randomly select a red infected person,
p.speed = white_speed_k * random.randint(1,5)
p.gotorandom()
p.gotorandom()
p.color('white')
screen.update()
running = True
while running:
for r in reds[:]:
if reds == []:break
r.fd(r.speed)
if r.collide_others('white'):  # Run into a doctor
r.color('lime')
r.set_tag('lime')
r.protect = True
r.speed=0
reds.remove(r)
limes.append(r)
r.update()
for g in limes[:]:
if reds == []:break
g.fd(g.speed)
if g.protect == False and g.collide_others('red'):
g.color('red')
g.set_tag('red')
g.speed = red_speed_k * random.randint(1,5)
limes.remove(g)
reds.append(g)
g.update()
g.bounce_on_edge()
for w in whites:
if reds == []:break
if random.randint(1,100) == 1:
rr = random.choice(reds)  # Randomly select a red infected person,
w.fd(w.speed)
w.update()