Build your own disease model: rough outline

These notes will give you some ideas about building up an epidemiological model of spreading disease.

To do this, we are going to use "Scratch". Scratch is a piece of software for building computer games and animation, however, there is nothing to stop us using it for something more serious.

Part One: The basic model

1) Basic Scratch tutorial if you haven't used it before (it's worth looking at the first bit anyway, just so you know what we call stuff).

2) Build a basic Zombie-bite model.

The Zombie-bite model is essentially this:
a) Make a bunch of sprites.
b) Make them wander randomly.
c) Make one of them a different colour from the rest, to show infection.
d) When something of the infected colour touches something of the uninfected colour, colour the touching thing infected.

That's basically it. Some hints:

Start simple. Easiest thing to do here is make a bunch of sprites. Next easiest thing to do is make them move randomly.

To make mutiple sprites you don't want to write each sprite separately. Instead, write one sprite with all the behaviour you need, and clone it using a clone block inside a loop. Start your program by cloning the sprite, and then build the behaviour you want into a "when starting as a clone" block inside the sprite.

To make a sprite wander randomly, randomly change the direction it is facing and then move. You can find a random number generator, which you can set to generate numbers between 1 and 360 in the operators block set.

To set the colour of your sprite, draw a new costume. You can switch between costumes using blocks, and test whether two objects of specific colours are touching using other blocks.

To pick out one sprite to say is infected, add a counter variable for all sprites to the program start, and change it by one each time the clone loop runs. In the "when starting as a clone" code you can then check if the value of the variable is one, and change that sprite so its costume is the infected colour.

Part Two: Exploring disease spreading

Once you've got your model working, check out our version, which includes some extra pages that take the model beyond the zombie-bite, to a full epidemiological model.

Return to the Index page.