MIHS-18P2 DT-JD

No preview image

1 collaborator

Default-person Jamisen Dowdy (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.2 • Viewed 71 times • Downloaded 9 times • Run 0 times
Download the 'MIHS-18P2 DT-JD' 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 [ max-bird ]
breed [ sheep a-bird ]
breed [airplane airplane ]
turtles-own [ energy ]
patches-own [ countdown ]

to setup
  clear-all
  ifelse netlogo-web? [set max-bird 10000] [set max-airplane 30000]


  ifelse model-version = "bird-airplane-grass" [
    ask patches [
      set pcolor one-of [ blue white ]
      ifelse pcolor = blue
        [ set countdown grass-regrowth-time ]
      [ set countdown random grass-regrowth-time ]
    ]
  ]
  [
    ask patches [ set pcolor blue ]
  ]

  create-bird initial-number-bird
  [
    set shape  "bird"
    set color white
    set size 1.5
    set label-color blue - 2
    set energy random (2 * bird-gain-from-food)
    setxy random-xcor random-ycor
  ]

  create-airplane initial-number-airplane
  [
    set shape "airplane"
    set color black
    set size 2
    set energy random (2 * airplane-gain-from-food)
    setxy random-xcor random-ycor
  ]
  display-labels
  reset-ticks
end 

to go
  ;
  if not any? turtles [ stop ]
  ;
  if not any? airplane and count bird > max-bird [ user-message "The birds have inherited the sky" stop ]
  ask bird [
    move
    if model-version = "sheep-wolves-grass" [
      set energy energy - 1
      eat-grass
      death
    ]
    reproduce-bird
  ]
  ask airplane [
    move
    set energy energy - 1
    eat-bird
    death
    reproduce-airplane
  if model-version = "sheep-wolves-grass" [ ask patches [ grow-grass ] ]
  ;
  tick
  display-labels
end 

to move
  rt random 50
  lt random 50
  fd 1
end 

to eat-grass  ;
  if pcolor = green [
    set pcolor brown
    set energy energy + bird-gain-from-food  ; sheep gain energy by eating
  ]
end 

to reproduce-bird  ; sheep procedure
  if random-float 100 < bird-reproduce [
    set energy (energy / 2)
    hatch 1 [ rt random-float 360 fd 1 ]
  ]
end 

to reproduce-airplane
  if random-float 100 < airplane-reproduce [
    set energy (energy / 2)
    hatch 1 [ rt random-float 360 fd 1 ]
  ]
end 

to eat-bird
  let prey one-of bird-here
  if prey != nobody  [
    ask prey [ die ]
    set energy energy + airplane-gain-from-food
  ]
end 

to death
  if energy < 0 [ die ]
end 

to grow-grass
  if pcolor = white [
    ifelse countdown <= 0
      [ set pcolor blue
        set countdown grass-regrowth-time ]
      [ set countdown countdown - 1 ]
  ]
end 



There is only one version of this model, created over 5 years ago by Jamisen Dowdy.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.