MIHS Challenge 3 - 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 [leaders leader] breed [followers follower] to setup clear-all set-default-shape followers "bug" set-default-shape leaders "circle" create-followers 10 ask followers [ setxy random-xcor random-ycor ] ;; the leader breed contains one turtle that is used to represent ;; a leader of the bugs (a circle) create-leaders 1 [ set shape "circle" set color white set size 1.5 hide-turtle ] reset-ticks end to go move-followers move-leader tick end to move-followers ;; followers will face toward the leader, then move forward ask followers ;; with a slight random wiggle [ if not [hidden?] of leader 10 ;; checks to make sure the leader is visible [face leader 10] ;; the leader is the 11th turtle created, so it has "who" # 10 ;; (the followers have "who" #'s 0-9). This checks to see if the leader ;; is present in the view fd .5 ;; forward 1 step rt random 10 ;; turn right lt random 10 ;; turn left ] end to move-leader ;; this code makes the leader appear at the same position as the cursor ask leaders ;; when the cursor is not inside the world, the leader is hidden [ setxy mouse-xcor mouse-ycor ;; only show the leader if the mouse pointer is ;; actually inside the view set hidden? not mouse-inside? ;; "mouse-inside?" checks to see if the mouse is inside the world view ;; when the mouse is outside the world view window, ;; the leader is toggled to hidden ] 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 3 - solution.png | preview | Preview for 'MIHS Challenge 3 - solution' | over 8 years ago, by Larry Bencivengo | Download |
This model does not have any ancestors.
This model does not have any descendants.