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 severe negative (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. Below is the interface.

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

  1. Setup and Go forever buttons.
  2. The sliders:
    • num-people with is the number of people ranging from 0 to 1000 in steps of 1.
    • wiggle-angle with is the wiggle angle ranging from 0 to 360 in steps of 1.
    • wiggle-step with is the wiggle step size ranging from 0 to 3 in steps of 0.1.
    • days-infected with is the initial number of days infected ranging from 0 to 100 in steps of 1.
    • days-immune with is the initial number of days immune ranging from 0 to 100 in steps of 1.
    Increment for all 1 except wiggle-step which has an increment of 0.1.
  3. Use the set-default-shape command on turtles to set their shape to "person". Note that it is an observer context command and should be set before creating any turtles! Note also that person is in quotes in your code.
  4. Turtles have a local variable: infected that is greater than zero if immune or infected. It must work this way:
    • Infected is never less than zero.
    • If infected is zero then the person is well and will be colored green.
    • If infected is greater than 0 up to a value of days-immune then the person is not sick but is immune and is colored yellow.
    • If infected is greater than days-immune then the person is sick and is colored red.
    • When a person is made sick the value of infected is set to the sum: days-immune + days-infected.
    • As long as infected > days-immune the turtle is sick and can infect others.
  5. Setup creates num-turtles number of turtles at random locations and headings and approximately percent-vaccinated percentage of them are immune for days-immune number of days.
  6. One of the turtles is made sick using the procedure make-sick as we did in class but the value of infected is set to the sum: days-immune + days-infected.
  7. The go procedure should: wiggle, heal, infect,.
  8. wiggle is the standard wiggle we used in class with a right turn, left turn and forward command using wiggle-angle and wiggle-step.
  9. In heal, decrements infected when appropriate and manages the colors of the turtles to show if they are sick, immune, or well.
  10. In heal, infected counts down from days-infected to 0, decrementing with each call to go as we did in class.
  11. Your simulation should plot two things at the bottom as seen in the interface. When you run setup it should call reset-ticks. Every time the go procedure runs it should execute the command tick. The plot should be set up so the maximum value of y is 1.0. It should plot using two distinguishable colors:
    • The ratio of number of immune but not sick turtles to the total number of turtles.
    • The ratio of number of sick turtles to the total number of turtles.

    Submission

    Save your results as a .nlogo file and submit the file to bblearn.