Program Your Own COVID-19 Simulator with Scratch
Summary
1-2 hours
1-2 hours
Programming, disease transmission, social distancing
Ben Finio, PhD, Science Buddies
Introduction
Do you keep hearing phrases like "social distancing" and "flatten the curve" in the news? What do they mean? Why are they important? In this activity, you will use the kid-friendly programming language Scratch to write a simulation that uses bouncing dots to represent healthy and sick people. The simulation will show how we can take measures to slow the spread of a transmissible disease like COVID-19.
This activity is not recommended for use as a science fair project. Good science fair projects have a stronger focus on controlling variables, taking accurate measurements, and analyzing data. To find a science fair project that is just right for you, browse our library of over 1,200
Science Fair Project Ideas or use the
Topic Selection Wizard to get a personalized project recommendation.
Materials
- Computer with internet access
Prep Work
-
-
Optionally, if you have never used Scratch before, you can follow some of their
tutorials.
Instructions
-
Watch this video for an overview of how to create a basic COVID-19 simulator in Scratch:
-
-
Once you have a working simulation, explore the effects of social distancing.
-
What happens if you increase the number of "people" in the simulation? To do this in the Science Buddies project, increase the "num_clones" variable.
-
What happens if the people in the simulation practice social distancing? To do this in the Science Buddies project, increase the second number in the "pick random 1 to 1" block.
| Why is social distancing important to help slow the spread of infectious diseases like COVID-19? |
-
See the
Further Exploration section suggestions about more things you could add to your program.
What Happened?
In your Scratch simulation, people are represented by colored dots that bounce around the screen. Green dots are healthy and red dots are sick. The virus is passed between dots that touch each other, representing close personal contact. When all the dots are moving around, they bump into each other very frequently, allowing the virus to spread rapidly. When people "stay home" (some of the dots hold still), it takes much longer for the virus to spread. Read the Digging Deeper section to learn more about why this is important.
Digging Deeper
Infectious diseases like COVID-19 are spread primarily through close person-to-person contact, including through droplets people emit when they cough or sneeze. This means that you are at the highest risk for catching the virus through daily contact with other people, like shaking hands with a sick person or sitting next to a coughing person on the bus. Once you are infected with the virus, you in turn can spread it to others. This is why social distancing—avoiding large gatherings, and staying at least 6 feet away from others in public places—is important to help slow the spread of the virus. Slowing the spread of the virus means that, at any given time, fewer people overall will have it. This, along with other preventative measures like frequent hand washing, helps "flatten the curve," and keep the total number of sick people below our healthcare system's capacity. You can visualize this effect by implementing social distancing in your Scratch simulation, which slows the rate at which the virus spreads.
Ask an Expert
Curious about the science? Post your question for our scientists.
For Further Exploration
- Add a timer and make your program stop when every person is infected.
- Add counters for the number of healthy and sick individuals in your simulation.
- Add recovery to your simulation, so individuals eventually get better (or die) after they become infected.
- Make the dots bounce off of each other instead of passing through each other.
- Add an animated graph showing the number of healthy/infected (and recovered/dead) individuals over time.
- Include a "super spreader" (a dot that moves faster than all the other ones).
Activities
STEM Activity
How well do you wash your hands? Do you just give them a quick rinse with water, or do you use soap? Do you wash the backs of your hands and in between your fingers? Good hand washing is one of the best ways to prevent the spread of germs and diseases like the flu and common cold. Try this activity to find out if there are hard-to-wash parts of your hands where germs might be hiding!
Read more
STEM Activity
Do you cover your coughs and sneezes? How far do you think the droplets can travel if you do not cover them? Why is this important to help prevent the spread of diseases like COVID-19? Try this activity to find out!
Read more
Links
Careers
Career Profile
Are you interested in developing cool video game software for computers? Would you like to learn how to make software run faster and more reliably on different kinds of computers and operating systems? Do you like to apply your computer science skills to solve problems? If so, then you might be interested in the career of a computer software engineer.
Read more
Career Profile
Computers are essential tools in the modern world, handling everything from traffic control, car welding, movie animation, shipping, aircraft design, and social networking to book publishing, business management, music mixing, health care, agriculture, and online shopping. Computer programmers are the people who write the instructions that tell computers what to do.
Read more
Career Profile
Do you like a good mystery? Well, an epidemiologist's job is all about solving mysteries—medical mysteries—but instead of figuring out "who done it" like a police detective would, they figure out "what caused it." They find relationships between a medical condition and things like human behavior, environmental toxins, genes, medical treatments, other diseases, and geographical location. For example, they ask questions like what causes multiple sclerosis? How can we prevent brain…
Read more
Career Profile
Are you interested in developing cool video game software for computers? Would you like to learn how to make software run faster and more reliably on different kinds of computers and operating systems? Do you like to apply your computer science skills to solve problems? If so, then you might be interested in the career of a computer software engineer.
Read more
Career Profile
Computer systems analysts have to know what computer programs and related tools are needed to efficiently get a job done. The jobs are usually carried out by other people, but the computer systems analyst makes sure the team has the right computer-based aids they need to do it. A computer systems analyst has to stay on top of the latest technologies, know the capabilities and limitations of different computer parts, and put all of this information together to help a group of people succeed.
Read more
Career Profile
Many aspects of peoples' daily lives can be summarized using data, from what is the most popular new video game to where people like to go for a summer vacation. Data scientists (sometimes called data analysts) are experts at organizing and analyzing large sets of data (often called "big data"). By doing this, data scientists make conclusions that help other people or companies. For example, data scientists could help a video game company make a more profitable video game based on players'…
Read more
Career Profile
Software quality assurance engineers and testers oversee the quality of a piece of software's development over its entire life cycle. Their goal is to see to it that the final product meets the customer's requirements and expectations in both performance and value. During the software life cycle, they verify (officially state) that it is possible for the software to accomplish certain tasks. They detect problems that exist in the process of developing the software, or in the product itself.…
Read more
Career Profile
Engineering managers not only have to be knowledgeable about engineering, but they also need the right skills to be a good manager. Engineering managers supervise and coordinate a team of engineers. There are many specific engineering fields in which they could work, including manufacturing, electrical design, nuclear engineering, software, aerospace, and many others.
Read more
Explore Our Science Videos
Junkbots Lesson Plan Introduction
Make a Slushy! Yummy STEM Project