Epidemy Simulation

In this exercise, you are going to write an epidemic simulator based on the simulation framework seen in lecture.

The scenario is as follows: the world (“Scalia”) consists of regular grid of 64 rooms, where each room is connected to four neighbouring rooms. Scaliosis – a vicious killer virus – rages among the population of the Scalia.

When a person becomes infected, she does not immediately get sick, but enters a phase of incubation in which she is infectious but not sick (so she looks safe to approach to other people). Citizens infected with the virus (whether visibly or not) quickly transmit it to other citizens in the same room.

In their attempt to avoid the diseased, Scalians often travel among rooms. Unfortunately, this helps the disease spread across the whole world.

The disease and behaviour of people is simulated according to the following rules.


  1. General:
  2. States of Scaliosis infection:
  3. Simulation and moves:

Graphical display

To make the project more interesting, we provide you with a graphical display class (class EpidemyDisplay) that is used to visualize simulations. The display is automatically available to you when you complete the provided (partial) EpidemySimulator class. To start the graphical output (and the simulation), run the simulations.gui.EpidemyDisplay object.

Healthy persons are painted in green color. Persons that have their sick field set to true are painted in red color, suitable to indicate visibly infected people. Immune (i.e. infected but not sick) people are painted in yellow.


  1. Implement an epidemy simulator according to the above rules by completing the partial EpidemySimulator class (available on the course web site). Make sure to first inspect the code of EpidemyDisplay and Simulator, and understand how the display uses the simulator’s agenda to perform the simulation (hint: the afterDelay method is the key to success!). Your task is to add the correct WorkItems to the agenda.

  2. Determine the average number of dead people after 150 days over a set of 5 experiment runs.

  3. Extend your simulation with air traffic: when a person decides to move, she will choose to take the airplane with a probability of 1%, thereby moving to a random room in the grid (rooms with visibly infected people are not avoided). How does air traffic impact the epidemy? Determine the average number of dead people over 5 runs.

  4. Pandemic Response. To reduce the number of casualties, the president of Scalia decides to enforce one of the following health policies:

    Which of the health policies is more effective (use the version with air traffic for your tests)?

  5. Use the SimConfig object to declare your configuration values for the simulations. When you submit, set them to the default values, and disable extensions (air traffic, reduced mobility and vaccination).


In the attached .zip file you will find an sbt project. You can unzip it and work on in with Eclipse or sbt, as you did with the previous assignments. Evaluating this exercise, however, will not proceed as before:

  1. On next week’s exercise session (21th November), you will have to present your solutions to the course TAs. This will consist of a visual inspection of the graphic simulation, and some question on your code. This means you are expected to have a solution by next Friday morning!
  2. Additionally, you will have to submit your code on moodle (details coming soon). Deadline for submission is also on Saturday, 22 November, 23:50h. This will give you some time to take our feedback from Friday into account.