Zombieland
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
Brain Eating Zombies trying to take over the world. Mortals wander around and try to avoid zombies and zombies slowly try to eat their brains.
HOW TO USE IT?
Setup button creates the zombie population and go button starts the madness. Green mortals are persons that have not detected any zombies in the vicinity and yellow mortals are persons that are running away from a zombie (with a panic speed midifier).
WHAT TO LOOK FOR?
There are certain unstable parameters values that if changed a little make the population either survive or succumb to the zombie apocalypse (Zombie population size, speed, vision).
Parameters
- mortalPopulation: Amount of mortals
- mortalVisionAngle: The range of degrees in which a mortal can detect a zombie
- mortalVision: Distance in which a mortal can detect a zombie
- mortalSpeed: Mortal movement speed
- mortalRunawyMultiplier: Mortal movement speed increase while being chased by a zombie
- zombiePopulation: Amount of zombies
- zombieVision: Distance in which a zombie can detect a mortal
- zombieVisionAngle: Range of degrees in which a zombie can detect a mortal
- zombieKillingRange: Distance in which a zombie can kill a human
- randomnessInZombiesSpeed:
- randomnessInZombiesDirection:
- contagious: Determines if an attacked human becomes a zombie or just dies
- zombiePen: Traces the zombies paths as they consume humanity
CREDITS AND REFERENCES
Héctor Manuel Sánchez Castellanos Ph.D. Student in Computer Sciences Instituto Tecnológico y de Estudios Superiores de Monterrey Campus Estado de México sanchez.hmsc@gmail.com
Comments and Questions
globals[] patches-own[] turtles-own[] breed[zombies zombie] breed[mortals mortal] to setup clear-all ask patches [ if(pxcor mod 15 = 0 or pycor mod 20 = 0 )[ ask neighbors[set pcolor gray] set pcolor gray ] ] zombieSetup mortalsSetup reset-ticks end to go ask zombies[attack] ask mortals[avoid] tick end ;;Breeds Movement Functions to attack if(zombiePen = true)[pen-down] killIfAnyNear ifelse (any? mortals in-radius zombieVision)[headTowardsMortal][headRandom] forward zombiesSpeed + (random randomnessInzombiesSpeed) * zombiesSpeed end to avoid let zombieAround other zombies in-cone mortalVision mortalVisionAngle ifelse any? zombieAround[runaway][moveHappily] end ;;Zombies Movement Functions to headTowardsMortal set heading (towards min-one-of mortals [distance myself]) + randomAngleRange randomnessInzombiesDirection moveTowardsValidPatch (zombiesSpeed + (random randomnessInzombiesSpeed) * zombiesSpeed) black 90 end to headRandom right randomAngleRange 10 moveTowardsValidPatch (zombiesSpeed + (random randomnessInzombiesSpeed) * zombiesSpeed) black 10 end ;;Mortals Movement Functions to runaway set shape "face neutral" set color yellow set heading (towards min-one-of zombies [distance myself]) + 180 moveTowardsValidPatch (mortalSpeed + mortalSpeed * mortalRunawaySpeedMultiplier) black 90 forward mortalSpeed + mortalSpeed * mortalRunawaySpeedMultiplier end to moveHappily set shape "face happy" set color green right randomAngleRange 10 moveTowardsValidPatch (mortalSpeed) black 10 forward mortalSpeed end ;;Auxiliary to-report patchAheadIsInvalid[distanceOfMovement forbiddenColor] ifelse([pcolor] of patch-ahead distanceOfMovement = forbiddenColor)[report true][report false] end to moveTowardsValidPatch[distanceOfMovement forbiddenColor randomRange] if(patchAheadIsInvalid distanceOfMovement forbiddenColor)[while[patchAheadIsInvalid distanceOfMovement forbiddenColor][right randomAngleRange randomRange]] end to-report randomAngleRange[range] report random range - random range end to getSick set breed zombies set color red set size 2 set shape "x" end to killIfAnyNear if any? mortals in-radius zombieKillingRange[ ifelse contagious [ ask mortals in-radius zombieKillingRange[getSick] ][ ask mortals in-radius zombieKillingRange[die] ] ] end ;;Setup Functions to zombieSetup create-zombies zombiePopulation[ set color red set size 2 set shape "x" setxy random-xcor random-ycor while[pcolor = black][setxy random-xcor random-ycor] ] end to mortalsSetup create-mortals mortalPopulation[ set color green set size 2 set shape "face happy" setxy random-xcor random-ycor while[pcolor = black][setxy random-xcor random-ycor] ] end
There is only one version of this model, created about 12 years ago by Héctor Sanchez.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Zombieland.png | preview | Preview for 'Zombieland' | about 12 years ago, by Héctor Sanchez | Download |
This model does not have any ancestors.
This model does not have any descendants.