Wolf Moose Predation

No preview image

1 collaborator

Default-person Diamond Montana (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0 • Viewed 52 times • Downloaded 4 times • Run 0 times
Download the 'Wolf Moose Predation' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [ max-moose ]  ; don't let moose population grow too large
; moose and wolves are both breeds of turtle.
breed [ moose a-moose ]  ; moose is its own plural, so we use "a-moose" as the singular.
breed [ wolves wolf ]
breed [ plants plant ]
turtles-own [ energy ]       ; both wolves and moose have energy
patches-own [ countdown ]

to setup
  clear-all
  set max-moose 10000

  ask patches [
    set pcolor green + 3
    set countdown random plant-regrowth-time  ; initialize plant regrowth times randomly
  ]
  ask n-of ( count patches / 2 ) patches [
    sprout-plants 1 [
      set shape "plant"
      set color green - 2
    ]
    set countdown plant-regrowth-time  ; overwrite random regrowth time if there is a plant present
  ]

  create-moose initial-number-moose  ; create the moose, then initialize their variables
  [
    set shape "moose"
    set size 2  ; easier to see
    set label-color blue - 2
    set energy random (2 * moose-gain-from-food)
    setxy random-xcor random-ycor
  ]

  create-wolves initial-number-wolves  ; create the wolves, then initialize their variables
  [
    set shape "wolf"
    set color black
    set size 2  ; easier to see
    set energy random (2 * wolf-gain-from-food)
    setxy random-xcor random-ycor
  ]

  reset-ticks
end 

to go
  ; stop the simulation of no wolves or moose
  if not any? turtles [ stop ]
  ; stop the model if there are no wolves and the number of moose gets very large
  if not any? wolves and count moose > max-moose [
    user-message "The moose have inherited the earth"
    stop
  ]
  ; stop the model after 500 ticks
  if ticks >= 500 [ stop ]

  ask moose [
    move
    set energy energy - 1
    eat-plant
    maybe-die
    reproduce-moose  ; moose reproduce at rate governed by slider
  ]

  ask wolves [
    move
    set energy energy - 1  ; wolves lose energy as they move
    eat-moose ; wolves eat a moose on their patch
    maybe-die
    reproduce-wolves ; wolves reproduce at random rate governed by slider
  ]

  ask patches [ grow-plant ]

  tick
end 

to move  ; turtle procedure
  rt random 50
  lt random 50
  fd 1
end 

to eat-plant  ; moose procedure
  ; moose eats plant, plant dies
  let food one-of plants-here
  if food != nobody [
    ask food [
      die
    ]
    set energy energy + moose-gain-from-food  ; moose gain energy by eating
  ]
end 

to reproduce-moose  ; moose procedure
  if random-float 100 < moose-reproduce [  ; throw "dice" to see if you will reproduce
    set energy (energy / 2)                ; divide energy between parent and offspring
    hatch 1 [ rt random-float 360 fd 1 ]   ; hatch an offspring and move it forward 1 step
  ]
end 

to reproduce-wolves  ; wolf procedure
  if random-float 100 < wolf-reproduce [  ; throw "dice" to see if you will reproduce
    set energy (energy / 2)               ; divide energy between parent and offspring
    hatch 1 [ rt random-float 360 fd 1 ]  ; hatch an offspring and move it forward 1 step
  ]
end 

to eat-moose  ; wolf procedure
  let prey one-of moose-here                    ; grab a random moose
  if prey != nobody  [                          ; did we get one?  if so,
    ask prey [ die ]                            ; kill it, and...
    set energy energy + wolf-gain-from-food     ; get energy from eating
  ]
end 

to maybe-die
  if energy < 0 [ die ]
end 

to grow-plant  ; patch procedure
  ; countdown on brown patches: if reach 0, grow some plant
  if not any? plants-here [
    ifelse countdown <= 0
    [
      sprout-plants 1 [
        set shape "plant"
        set color green - 2
      ]
      set countdown plant-regrowth-time
    ] [
      set countdown countdown - 1
    ]
  ]
end 

; Copyright 1997 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created over 2 years ago by Diamond Montana.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.