2014-12-12 LabZombies

posted Dec 12, 2014, 5:24 AM by Samuel Konstantinovich   [ updated Dec 12, 2014, 11:51 AM ]

Lab: Zombies vs Humans

1. Overview:

-You will work on this today, and complete it at home.

-You will be given a partner for this project on Monday. 

-You will be required to swap your 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)


2. Zombie Behavior:

-When there is a human in a radius of zombie_vision_radius (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, and a new zombie is created it should look like the other zombies. 


3a. Human Behavior

-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.

3b. 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 

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

---People start with maximum_stamina (make a slider). Their stamina decreases by 1 every time they successfully run.


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, and human_vision_radius

- Make Monitors for : the number of zombies and the number of humans

- Your project should run at an appropriate speed.

- 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: 

in-radius

any?

min-one-of   

max-one-of

face



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 ]

]

Comments