MIHS-17 Period 3 Katie S, Derek W
No preview image
Model was written in NetLogo 6.0.2
•
Viewed 79 times
•
Downloaded 11 times
•
Run 0 times
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
breed [primaries primary] breed [secondaries secondary] breed [tertiaries tertiary] breed [flowers flower] turtles-own [energy] patches-own [regrowthcounter] to setup clear-all setup-turtles setup-patches reset-ticks end to go generate-flowers ask primaries[ move-turtles eat-grass reproduce-primary check-death ] ask secondaries[ move-turtles eat-primaries reproduce-secondary check-death ] ask tertiaries[ move-turtles eat-secondaries eat-flowers reproduce-tertiary check-death ] ask patches[ grass-grow ] tick end to move-turtles rt random 50 lt random 50 fd 0.5 set energy energy - 0.1 end to eat-grass if pcolor = green[ set pcolor brown set energy energy + energy-from-grass ifelse show-energy? [set label energy] [set label ""] ] end to eat-primaries ifelse show-energy? [set label energy] [set label ""] let prey one-of primaries-here if prey != nobody[ set energy [energy] of prey * (percent-taken / 100) ask prey[die] ] end to eat-secondaries ifelse show-energy? [set label energy] [set label ""] let prey one-of secondaries-here if prey != nobody[ set energy [energy] of prey * (percent-taken / 100) ask prey[die] ] end to eat-flowers let prey one-of flowers-here if prey != nobody[ set energy energy + 10 ask prey[die] ] end to reproduce-primary if random 100 < 4[ if energy > 25[ set energy energy - 10 hatch 1[ set energy 25 ] ] ] end to reproduce-secondary if random 100 < 4[ if energy > 2[ set energy energy - 4 hatch 1[ set energy 5 ] ] ] end to reproduce-tertiary if random 200 < 4[ if(energy > 40)[ set energy energy - 40 hatch 1[set energy 40] ] ] end to check-death if energy <= 0 [die] end to generate-flowers create-flowers random 3[ setxy random-xcor random-ycor set color pink set size 2 set shape "plant" ] end to grass-grow if pcolor = brown[ ifelse regrowthcounter <= 0 [set pcolor green set regrowthcounter random grass-regrowth-time] [set regrowthcounter regrowthcounter - 1] ] end to setup-turtles if trophic-levels >= 1[ create-primaries starting-turtles [ setxy random-xcor random-ycor set color white set size 1 set energy 30 ] ] if trophic-levels >= 2[ create-secondaries starting-turtles / 4[ setxy random-xcor random-ycor set color red set size 1.1 set energy 60 ] ] if trophic-levels >= 3[ create-tertiaries starting-turtles / 16[ setxy random-xcor random-ycor set color blue set size 1.2 set energy 60 ] ] end to setup-patches ask patches [ set pcolor one-of [ green brown ] ifelse pcolor = green [ set regrowthcounter grass-regrowth-time ] [ set regrowthcounter random grass-regrowth-time ] ; initialize grass regrowth clocks randomly for brown patches ] end
There is only one version of this model, created over 6 years ago by katie stoops.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.