2016-01-05 Zombies Updated

posted Jan 5, 2016, 4:53 AM by Samuel Konstantinovich   [ updated Jan 5, 2016, 4:53 AM ]

Tomorrow: You will be required to swap your netlogo file with your partner, and add new features to your partner's code. This means you should be writing things in a readable and clear way (no crazy variable names or poor spacing/newlines)

Lab: Zombies vs Humans

Modifications to yesterday's lab:

1. Zombie Behavior:

-When there is a human in a cone of zombie-vision-radius (make a slider)zombie-vision-angle (make a slider) the Zombies chase after the closest human at a speed of 0.5 Otherwise they shamble. Shamble is a slow wiggle (move forward at 0.1, and modify the angle randomly +/- 20 degrees). 

-When a zombie catches a person (the person is on the same patch as the zombie):

    -the person dies

    -a new zombie is created. 

    -This new zombie turn 90 degrees so they separate quickly

Humans have a stamina variable, and start with maximum_stamina (make a slider)

2. Human Behavior when they don't see a zombie

-Humans normally wiggle at a speed of 0.2, angle at +/- 20 randomly.

-When a person wiggles, they also they gain 1 stamina (but no more than max-stamina (make a slider)

3.  Human Behavior when they see a zombie

    -When one or more zombies are closer than human_vision_radius (make a slider) units away, they try to run from the zombies.

    -When a person is running they check their stamina:

        When there is 1 or more stamina, the person move away from the nearest zombie at speed 1.0, they lose 1 stamina.

        When there is 0 stamina, the person moves away from the nearest zombie at speed 0.1 (do not recover stamina here)

4. Miscellaneous:

- Make Sliders for starting_zombies ( 1-20), starting_humans (1-100)

- Make Slider for maximum_stamina (20-100)

- Make Sliders for zombie_vision_radius, zombie_vision_angle, and human_vision_radius

- Make Monitors for : 

    the number of zombies

    the number of humans

- Your project should run at an appropriate speed. Put an every command in your go.

- Zombies are all different shades green, humans are all orange shades. (Don't make them too dark or bright)

- OPTIONALLY AT HOME: make different custom shapes (“zombie” , "uglyZombie" etc) in the shapes editor (don't spend too much time on this) Make sure you duplicate the “person” shape instead of just editing it, or you will lose the person shape.

You will need: 






for example:

To see if there are any things in a 5 unit radius

if any? things in-radius 5[

   do stuff


To face a specific thing

face thing

To face away, turn around after facing it.

To find the closest thing and turn it red

if any? things


ask min-one-of things [distance myself]

  [ set color red ]