The Task

This should be fairly easy if you took good notes in class. In Netlogo, reproduce and upgrade the virus simulator we did in class.

The Virus Simulator with Immunity

Most of the code for this we wrote in class. So you need to be able to reconstruct that code from your notes or from the notes of a friend. Do not share files, that could earn you a negative (yes that is less than zero) score (see class policies). There are a few changes to the code you must do but otherwise it looks a lot like the class code. Here is the required interface:

Your version of the program for this assignment should have these things:

  1. Setup and Go forever buttons.
  2. The sliders whose upper bounds are num-turtles 1000, percent-vaccinated 100, percent-virulence 100, wiggle-distance 2, wiggle-angle 360, days-sick 100, days-immune 200. Lower bounds are all zero. The increment for all sliders is all 1 except wiggle-distance which has an increment of 0.1.
  3. Turtles have local variable infected. It is greater than zero if immune or infected. Here is a number line representation of the values possible in the infected variable and the colors for well, immune, and sick:
  4. Setup creates num-turtles number of turtles at random locations.
  5. There should be procedures make-well, make-immune, and make-sick. They each set infected to the correct value and set the color to the correct color for the state of the turtle. These routines are the only place where color is set!! See the code from class.
  6. The turtles are colored red for infected, yellow for immune but not infected, and green for not immune and not infected. Just like in class, use a cascade of ifelse statements in the heal procedure.
  7. (30 pts) In setup, all turtles are well and then make approximately percent-vaccinated percentage of them immune for days-immune number of days. Then make one of the turtles sick using the procedure make-sick as we did in class.
  8. Set the shape of turtles to "person".
  9. The go procedure should: move, heal, and infect.
  10. As long as infected > days-immune the turtle is sick and can infect others.
  11. move is the standard wiggle we used in class with a right turn, left turn and forward command using wiggle-angle and the distance it moves forward is wiggle-distance.
  12. In heal, infected counts down from days-infected + days-sick to 0, decrementing with each call to go as we did in class. If infected is about to be decremented to 0 it should call make-well. If it is about to immune it should call make-immune just as we did in class.
  13. (20 pts) In the infect routine it should make sick those that are well as before, but also it should do that with a probability of percent-virulence. That is where in class we just called make-sick now we should put in a "roll of the die" to see if it should make them sick. For example, if the interface slider for percent-virulence is set to 60 then 60% of the time it should make the turtle sick.
  14. Your simulation should plot two things at the bottom of the interface as seen in the interface image. When you run setup it should call reset-ticks. Every time the go procedure runs it should execute the command tick.
  15. The plot should plot the number of turtles sick and the number strictly immune using two distinguishable colors of your choice.
  16. The plot should "Show legend". See the box for editing the plot. The pen names should be "Sick" and "Immune".

    Submission

    Save your results as a .nlogo file and submit the file to the submission page. Use the submission page on the class web page.