A Basic Model

This first model is pretty simple.  Just two breeds of turtles moving randomly.  Zombies move around hoping to land on a human and eat their brains.  Humans randomly move away if there is a zombie in a neighboring patch.

A video overview of the model can be found on my YouTube Channel - Complxity Geek.

powered by NetLogo

A working copy of the model can be downloaded from My Google Drive.

WHAT IS IT?

Zombies!!

HOW IT WORKS

Eat Brains!!!

HOW TO USE IT

Push setup to get ready to eat brains!
Push Go to eat brains!

THINGS TO NOTICE

Zombies are random at this point - they do not seek brains! Yet!

THINGS TO TRY

Start with just 1 zombie.

EXTENDING THE MODEL

Guns for Humans! Brain Seeking! Buildings! Super Zombies!

NETLOGO FEATURES

Still working on this.

RELATED MODELS

None that I know of.

CREDITS AND REFERENCES

Michael Ball, Research Coordinator, Computational Modeling & IT Resources at The Center for Complexity in Health - KSUA

PROCEDURES

;; Zombieland Model ver 1.0 - a basic simulation of a zombie attack

breed [human]
breed [zombie]

globals [
  percent-human  ;;Percentage of agents that are human.
  percent-zombie  ;;Percentage of agents that are zombies.
  ]

turtles-own [
  speed  ;;How fast the agents can move.
  zombie-near
  human-near
  scared?
  hungry?
  ]
  
to Setup  ;;Clear previous run and setup initial agent locations.
  clear-all
  pop-check
  setup-agents
  
end

to go
  scared-check
  tick
end

to setup-agents ;; Create the desired number of each breed on random patches.
  set-default-shape zombie "person"
  set-default-shape human "person"
  
  ask n-of initial-zombies patches
    [ sprout-zombie 1
      [ set color red ] ]
      
  ask n-of initial-humans patches
    [ sprout-human 1
      [ set color blue ] ]
      
end  

to scared-check ;; Test if humans are near a zombie and move them if they are.
  ask human [
    set zombie-near count (turtles-on neighbors) with [breed = zombie]
    set speed human-speed
    set scared? zombie-near >= 1
    ]
    ask human with [ scared? ] 
      [ find-new-spot ]
      
  ask zombie [
    if any? other turtles-here
    [convert]
    set human-near count (turtles-on neighbors) with [breed = human]
    set speed zombie-speed    
    set hungry? human-near >= 1
    ]
    ask zombie with [ hungry? ] 
      [ seek-brains ]
    ask zombie with [not hungry?]
      [find-new-spot]
      
end
  
to find-new-spot ;; Pick the patch the agent moves to.
    rt random-float 360
    fd random-float speed
    if any? other turtles-here
    [ convert]
end  
  
to convert
  ask turtles-on patch-here [set breed zombie]
  ask turtles-on patch-here [set color red]
end

to seek-brains
end
  
  
to pop-check  ;; Make sure total population does not exceed total number of patches.
  if initial-zombies + initial-humans > count patches
    [ user-message (word "This Zombieland only has room for " count patches " agents.")
      stop ]
end