The zombies

Setup
Imagine a 100 meter x 100 meter fenced in field that starts with one randomly placed zombie and a user defined amount of randomly placed people. Your objective is to model what would happen in this scenario given the following rules
Start with a user defined amount of people in the field (between 1 and 300)
-Use the input( ) function to ask the user how many people to start with
Start with a user defined lifespan for the zombies (between 15 and 600 minutes)
-Use the input( ) function to ask the user for this lifespan
Randomly place the people in the field using rand( )
-Note - to randomly place the people, you need to randomly generate two numbers (one for the x-location and one for the y-location)
-To generate a random number between 0 and 100 you can type 100*rand;
Randomly place a zombie in the field using rand( )

  • See notes above for people placement
    Simulation
    The zombies must follow the following rules:
    -Each time step the zombies can move a random distance between -1 and 1 meters in the x-direction
  • Each time step the zombies can move a random distance between -1 and 1 meters in the y-direction
  • They may not leave the 100 x 100 square (if a person goes outside the 100 x 100 square, reset them at the edge)
  • If the x-position of zombie 3 is less than 0, set the x-position as 0 or if the x-position is greater than 100, set the x-position at 100 (same rules for y-position)
    -The zombies rot or die after their lifespan is complete
    The people must follow the following rules
    -Each time step the people can move a random distance between -3 and 3 meters in the x-direction
  • Each time step the people can move a random distance between -3 and 3 meters in the y-direction
  • They may not leave the 100 x 100 square (if a person goes outside the 100 x 100 square, reset them at the edge)
  • if the x-position of person 3 is less than 0, set the x-position as 0 or if the x-position is greater than 100, set the x-position at 100
    -If a person gets within 1 meter of a zombie, they turn into a zombie
    The simulation ends when one of the following conditions is met
    -There are no people left
    -There are no living zombies left