MIHS Michelle, Crystal, and Bridget

MIHS Michelle, Crystal, and Bridget preview image

1 collaborator

Default-person Michelle L (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.3.1 • Viewed 141 times • Downloaded 15 times • Run 0 times
Download the 'MIHS Michelle, Crystal, and Bridget' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

globals [grass]
turtles-own [energy]
patches-own [countdown]
breed [rabbits rabbit]
breed [foxes fox]
breed [coyotes coyote]

to setup
  clear-all
  ask patches [ set pcolor green ]
  if grass? [
    ask patches [
      set pcolor one-of [green brown]
      if-else pcolor = green
      [ set countdown grass-regrowth-time]
      [ set countdown random grass-regrowth-time ]
    ]
  ]
    create-turtles 10 [set shape "rabbits"]
    set color white
    set size 1
    set label-color blue - 2
    setxy random-xcor random-ycor



    create-turtles 5 [set shape "foxes"]
    set color orange
    set size 2
    set label-color blue - 2
    setxy random-xcor random-ycor

    create-turtles 2 [set shape "coyotes"]
    set color brown
    set size 2.5
    set label-color blue - 2
    setxy random-xcor random-ycor

to eat-grass
  ask turtles [
    if pcolor = green [
      set pcolor black
           ;; the value of energy-from-grass slider is added to energy
      set energy (energy + energy-from-grass)

to go
  if ticks >= 500 [ stop ] ;; stop after 500 ticks
  move-turtles
  eat-grass
  check-death
  reproduce
  regrow-grass
  tick                     ;; increment the tick counter and update the plot
end 

to move-turtles
  ask turtles [
    right random 360
    forward 1
    set energy energy - 1  ;; when the turtle moves it looses one unit of energy
  ]
end 


  ifelse show-energy?
    [ set label energy ] ;; the label is set to be the value of the energy
    [ set label "" ]     ;; the label is set to an empty text value
  ]
end 

to reproduce
  ask turtles [
    if energy > birth-energy [
    set energy energy - birth-energy  ;; take away birth-energy to give birth
    hatch 1 [ set energy birth-energy ] ;; give this birth-energy to the offspring
    ]
  ]
end 

to check-death
  ask turtles [
    if energy <= 0 [ die ] ;; removes the turtle if it has no energy left
  ]
end 

to regrow-grass
  ask patches [ ;; 3 out of 100 times, the patch color is set to green
    if random 100 < 3 [ set pcolor green ]
  ]
end 

There is only one version of this model, created over 7 years ago by Michelle L.

Attached files

File Type Description Last updated
MIHS Michelle, Crystal, and Bridget.png preview Preview for 'MIHS Michelle, Crystal, and Bridget' over 7 years ago, by Michelle L Download

This model does not have any ancestors.

This model does not have any descendants.