MIHS: Kyle Huynh - BirdvButterfly
No preview image
Model was written in NetLogo 5.3.1
•
Viewed 160 times
•
Downloaded 17 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
Click to Run Model
globals [grass] breed [butterfly a-butterfly] breed [birds bird] turtles-own [energy] patches-own [countdown] to setup clear-all ask patches [ set pcolor white ] set-default-shape butterfly "butterfly" create-butterfly initial-number-butterfly [ set color black set size 3 set label-color black set energy random (2 * 20) setxy random-xcor random-ycor ] set-default-shape birds "bird side" create-birds initial-number-birds [ set color setcolor set size 3.5 set energy random (400) setxy random-xcor random-ycor ] display-labels set grass count patches with [pcolor = green] reset-ticks end to go if not any? birds [ stop ] ask butterfly [ move death reproduce-butterfly ] ask birds [ move set energy energy - 1 catch-butterfly death reproduce-birds ] tick display-labels end to move rt random 50 lt random 50 fd 1 end to consume-things set energy energy + 4 end to reproduce-butterfly ;; butterfly procedure if random-float 200 < butterfly-reproduce [ let pred one-of birds set color [ color ] of pred set energy (energy / 2) hatch 1 [ rt random-float 360 fd 1 ] ] end to reproduce-birds ;; bird procedure if hide? = true [ if random-float 1000 < bird-reproduce [ set color setcolor set energy (energy / 2) hatch 1 [ rt random-float 360 fd 1 ] ] ] if hide? = false [ if random-float 100 < bird-reproduce [ set color setcolor set energy (energy / 2) hatch 1 [ rt random-float 360 fd 1 ] ] ] end to catch-butterfly let prey one-of butterfly-here if prey != nobody [ if hide? = true [ if [ color ] of prey = color [ ask prey [ die ] set energy energy + 15 ]] if hide? = false [ ask prey [ die ] set energy energy + 15 ] reproduce-birds ] end to death if energy < 0 [ die ] end to grow-grass if pcolor = brown [ ifelse countdown <= 0 [ set pcolor green set countdown grass-regrowth-time ] [ set countdown countdown - 1 ] ] end to display-labels ask turtles [ set label "" ] if show-energy? [ ask birds [ set label round energy ] ] end
There are 3 versions of this model.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.
Kyle Huynh
project
By Kyle Huynh, Justin Wampold, and Caroline Young
Posted over 7 years ago
Kyle Huynh
Period
Bencivengo Period 5
Posted over 7 years ago