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 175 times • Downloaded 21 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.)


WHAT IS IT?

(a general understanding of what the model is trying to show or explain)

HOW IT WORKS

(what rules the agents use to create the overall behavior of the model)

HOW TO USE IT

(how to use the model, including a description of each of the items in the Interface tab)

THINGS TO NOTICE

(suggested things for the user to notice while running the model)

THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)

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

(models in the NetLogo Models Library and elsewhere which are of related interest)

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

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 6 years ago by Jamisen Dowdy.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.