ZombieApocalypse_Final
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This is a zombie apocalypse model intended to show human behavior in the face of extreme adversity. It is essentially a survivalist situation in which people can fight zombies and eat the resources around them in order to attempt to stay alive.
HOW IT WORKS
AGENTS
Humans
Initially I start out having levels of ENERGY AFFABILITY AGGRESSION and have checks to see whether or not I am infected with the zombie virus (INFECTED?) and/ or whether or not I am fighting (FIGHTING?)
On every clock-tick, I move in a random direction and check a few things:
If I can cluster and if my neighbors have the same affability level as me, we become friends and link together. If not, I AVOID them.
If there is a zombie in my vicinity, I RUN-AWAY from it
If there is a zombie on the same patch as me, I check to see if I can fight it based on my aggression levels and energy. If I can and I can cluster with other humans, I call my friends over with GATHER-FOR-FIGHT and we attempt to kill the zombie together. Some of us may die or become infected. If I can, but cannot cluster with other humans, I attempt to fight off the zombie on my own resulting in either my infection, death, or the death of the zombie. If I can't fight the zombie, I either become infected or die.
If I am fighting, I turn red momentarily.
If my energy drops below a certain level (aka, I get hungry) my aggression levels start to increase.
If my energy hits 0, I die.
If I am on a yellow food patch that is not depleted, I eat and gain energy.
If I have enough energy to reproduce and the reproduce? toggle is on, then I make a child that has the same affability and aggression levels as me.
Zombies
Initially, the user assigns me to have the zombie virus. This means I have no AFFABILITY, a newly set ENERGY level, and a newly set AGGRESSION level.
On every clock tick, I move in a random direction and check a few things:
- If I am on the same patch as a human and it has a certain energy level, I either infect it, or eat its brains for energy, or get killed by the human(s) depending on the situation.
Patches
Initally, I am assigned to either be a background patch, or a patch with food on it.
There are only food patches in three quadrants of the environment.
On every clock tick:
- If there is a human on me, they eat food and deplete the store that I have, but I regrow food according to a RESOURCE-REPLENISH-RATE sometimes as well.
HOW TO USE IT
NUM-HUMANS slider : sets the number of humans in the simulation
NUM-ZOMBIES slider : sets the number of humans with the zombie virus in the simulation
ENERGY-GAIN-FROM-FOOD slider: sets the amount of energy a human gains by eating food
RESOURCE-REPLENISH-RATE slider: sets the rate at which the food in the model grows back
FOOD-DENSITY slider: sets the density of the distribution of food patches throughout the model
SETUP-CLEAR button: sets up the model and clears all plots
SETUP-KEEP button: sets up the model but doesn't clear plots from previous runs
CLUSTER? toggle: allows the user to toggle whether or not the humans will make connections.
REPRODUCE? toggle: allows the user to toggle whether or not the humans will reproduce or not during the run.
GO (continuous) button: runs the model
ZOMBIE-VIRUS-GROWTH plot: shows the growth of the zombie virus over time
THINGS TO NOTICE
Regional grouping of humans is interesting. The clustering becomes tighter as time goes on. The number of people in a cluster also increase. Sometimes there are a few large clusters or a bunch of little ones. It's interesting to see under which conditions these clusters of humans form.
THINGS TO TRY
Toggle the clustering behavior and see what happens.
Vary the food density in the model. Can you make it so that the zombie virus is eradicated?
EXTENDING THE MODEL
In order to extend the model, try adding different types of resources that different types of people use could produce potentially interesting results (e.g. only aggressive people can use weapons, and fight zombies, while submissive people gather food for the "tribes")
It might also be interesting to see whether or not different tribes of people form and whether they barter their resources in order to stay alive.
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
Virus Model Wolf-sheep predation model
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
;;;;;;;;;;;;;;;;;; ;; Declarations ;; ;;;;;;;;;;;;;;;;;; globals [ run-number ;; counter used to keep the model running for a little ;; while after the last turtle gets infected delay ] breed [ humans human ] humans-own [ energy ;; human energy level affability ;; how friendly the human is (helps determine whether they will group with others) infected? ;; boolean - are they infected with the zombie virus or not? aggression ;; measures likelihood of fighting zombies fighting? ;; boolean - are they currently fighting or not ] patches-own [resource-level num-humans-on-patch is-growing-food? ] ;;;;;;;;;;;;;;;;;;;;; ;; Setup Functions ;; ;;;;;;;;;;;;;;;;;;;;; ;; clears the plot too to setup-clear clear-all set run-number 1 setup-world end ;; note that the plot is not cleared so that data ;; can be collected across runs to setup-keep clear-turtles clear-patches set run-number run-number + 1 setup-world end ;; scatters food patches across the world in 3/4 quadrants. The patches also have varying food density levels to setup-world set-default-shape humans "person" ask patches [ ifelse random-float 100 < food-density [ ifelse pxcor > 0 or pycor < 0 [set pcolor yellow set is-growing-food? true] [set pcolor gray ]] [set pcolor gray] ] set delay 0 create-some-humans create-some-zombies reset-ticks end ;; creates humans and gives them certain properties to create-some-humans create-humans num-humans [ setxy random-pxcor random-pycor ;; put humans on patch centers set color black set heading 90 * random 4 set energy 20 set infected? false set fighting? false set affability 5 set aggression 5 ] end ;; for infect button - user initially infects a few humans with the zombie virus to create-some-zombies create-humans num-zombies [ setxy random-pxcor random-pycor set heading 90 * random 4 set infected? true set color green set affability 0 set energy 30 set aggression 10 ] end ;;;;;;;;;;;;;;;;;;;;;;; ;; Runtime Functions ;; ;;;;;;;;;;;;;;;;;;;;;;; to go humans-wander increase-aggression reproduce fight ;; Humans will cluster together if they have the same affability level (if they are nice to each other, they form links/ ;; groups) and will avoid each other if one person is less nice than the other. if cluster? [ ask humans with [not infected?] [ let x self ask humans-on neighbors [ if not infected? [ let aff-h [affability] of x if aff-h = affability [ create-link-with x ask links [ set color blue] set affability affability + 1 ] if affability < aff-h [ avoid ] ] ] ] ] eat-food run-away infect-human human-death-natural fight-color regrow-resources set num-zombies count humans with [infected?] set num-humans count humans with [not infected?] if num-zombies = 0 or num-humans = 0 [ stop ] tick end ;; controls the general motion of the humans to humans-wander ask humans[ rt (random 4) * 90 fd 1 if not infected? [ set energy energy - 0.1 ]] end ;;;;;;;;;;;;;;;;;;;;;;; ;;; Human Behaviors ;;; ;;;;;;;;;;;;;;;;;;;;;;; ;; If a human's energy runs to 0, they die automatically. to human-death-natural ask humans [ if not infected? and (energy <= 0) [ die set num-humans num-humans - 1] ] end ;; Humans turn around and avoid each other if they encounter each other. Used in the clustering behavior. to avoid let candidates patches in-radius 1 with [ not any? humans-here with [ infected? ] ] ifelse any? candidates [ face one-of candidates ] [ rt (random 4) * 90 ] end ;; Humans will run-away from a zombie by moving a farther distance (essentially a sort of jump away from the zombies ;; if they are nearby) to run-away ask humans with [infected?] [ ask humans-on neighbors [ if not infected? [ rt (random 4) * 90 fd 2 ] ] ] end ;; If humans are hungry, they get cranky and more aggressive. to increase-aggression ask humans with [energy <= 20 and not infected?] [ set aggression aggression + 0.5 ] end ;; If a human is strong enough to fight zombies, he calls over the people he is linked to in order to kill the zombie ;; with help. Humans also get more aggressive when gathering for a fight, like they are feeding off each other's energy. to gather-for-fight ask humans with [not infected?] [ let x myself ask link-neighbors [ move-to x set fighting? true ask humans-here with [infected?] [ set energy energy - num-humans if energy <= 0 [die]] ] set aggression aggression + 1 ] end ;; makes it easier to see who is fighting to fight-color ask humans with [not infected?] [ if fighting? [set color red] ] end ;; Fight behavior for humans - gathers up friends and tries to kill a zombie. ;;and energy >= 30 and aggression >= 6 to fight ask humans with [not infected? and energy >= 30 and aggression >= 6] [ if any? humans-here with [infected?] [ ifelse cluster? [gather-for-fight] [set fighting? true ask humans-here with [infected?] [ die ] ] ] ] end ;; In order to keep their energy up, humans have to keep eating food. to eat-food ask humans with [not infected? ] [ if pcolor = yellow [ set pcolor gray set energy energy + energy-gain-from-food ;; increment human energy level ] ] end to reproduce if reproduce? [ ask humans with [not infected?] [ let x self if energy >= 100 [ set energy energy - 50 ;; reproduction transfers energy hatch 1 [ set energy 20 set affability [affability] of x set aggression [aggression] of x ] ;; to the new agent ] ] ] end ;;; Zombie procedures ;; Zombies have to eat too, but instead of food, they feast on fresh human brains to eat-brains ask humans with [infected?] [ ask other humans-here with [not infected?] [ if energy < 10 [ die ] set energy energy + 3 ] ] end ;; If a human encounters a zombie and their energy level is between a certain threshold, then the human gets infected by ;; the virus to infect-human ask humans with [infected?] [ ask other humans-here [ if not infected? and (energy < 15 and energy > 10) [ set infected? true set color green set affability 0 set energy 30 ask my-links [die] ] ] ] end ;;;;;;;;;;;;;;;;;;;;;; ;; Patch procedures ;; ;;;;;;;;;;;;;;;;;;;;;; ;to resource-level-energy ; set energy resource-level ;end ; ;;; recolor the food to indicate how much has been eaten ;to recolor-resources ;set pcolor scale-color yellow (10 - resource-level) -10 20 ;end ;; regrow the food to regrow-resources ask patches with [pcolor = gray] [ if is-growing-food? != 0 [ if (random-float 100 < resource-replenish-rate) and (pxcor > 0 or pycor < 0) [ set pcolor yellow ] ] ] end
There are 2 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Tellakat Final Poster.pptx | powerpoint | Poster Session Poster | about 12 years ago, by Mohini Tellakat | Download |
Tellakat_Mohini_FinalProjectPaper and Data.zip | data | Final Paper, data, and graphs | about 12 years ago, by Mohini Tellakat | Download |