MIHS Challenge 2 - solution
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
breed [predators predator] ;; this statement declares a new breed of turtles called "predators" breed [bugs bug] ;; the first name refers to ALL bugs; the second name can refer to ;; one specific bug (for example bug 7) to setup clear-all set-default-shape bugs "bug" ;; sets the default shape for ALL bugs set-default-shape predators "circle" create-bugs 10 ask bugs [ setxy random-xcor random-ycor ] ask bug 7 ;; asks one specific bug to make itself bigger [ set size 2 ] ;; the predator breed contains one turtle that is used to represent ;; a predator of the bugs (a menacing circle) create-predators 1 [ set shape "circle" set color white set size 1.5 set heading 315 setxy 0 0 ] reset-ticks end to go ;; when the "go" button is clicked, this loop repeats until the button is clicked again move-bugs ;; this calls the procedure named "move-bugs" defined below move-predator ;; this calls the procedure named "move-predator" tick end to move-bugs ;; this makes the bugs move when it is "called" from the "to go" loop above ask bugs ;; asks ALL bugs to move [ fd .5 ;; forward 1 step rt random 10 ;; turn right lt random 10 ;; turn left ] ask bug 7 [fd 1] ;; asks one specific bug to make an extra move end to move-predator ;; this makes the predators move ask predators [ fd 1 ;; forward 1 step rt random 10 ;; turn right lt random 10 ;; turn left ] end
There is only one version of this model, created over 8 years ago by Larry Bencivengo.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
MIHS Challenge 2 - solution.png | preview | Preview for 'MIHS Challenge 2 - solution' | over 8 years ago, by Larry Bencivengo | Download |
This model does not have any ancestors.
This model does not have any descendants.