Fish shoals
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This section could give a general understanding of what the model is trying to show or explain.
HOW IT WORKS
This section could explain what rules the agents use to create the overall behavior of the model.
HOW TO USE IT
This section could explain how to use the model, including a description of each of the items in the interface tab.
THINGS TO NOTICE
This section could give some ideas of things for the user to notice while running the model.
THINGS TO TRY
This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
EXTENDING THE MODEL
This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
NETLOGO FEATURES
This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.
RELATED MODELS
This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
CREDITS AND REFERENCES
This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
Comments and Questions
turtles-own [enemies friends nearest_friend speed escape escapeangle alert imitation dist dist2] globals [step] to setup ;; (for this model to work with NetLogo's new plotting features, ;; __clear-all-and-reset-ticks should be replaced with clear-all at ;; the beginning of your setup procedure and reset-ticks at the end ;; of the procedure.) __clear-all-and-reset-ticks ask patches [set pcolor 101 + random-normal 0 0.1] cro predators_num [setxy random-xcor random-ycor set color red set shape "mare" set size 2.3 set speed random-float 0.5 ] cro fish_num [setxy random-xcor random-ycor set shape "mare" set color gray set size 1.3 set speed random-float fish_speed set dist distance turtle 0 set dist2 precision dist 3 ;set label dist2 set escape 0.3 set escapeangle random-float 50 set imitation (speed + escape) - speed] set step random 1 + 3 end to go choose_step ask turtles [if speed < 0.1 [set speed 0]] repeat step [ask turtles [fd speed] display] ask turtles with [size = 1.3] [set color gray set speed random-float fish_speed set escape 0.3 set dist distance turtle 0 set dist2 precision dist 3] plotagents end to choose_step ask turtles with [size = 1.3]; chiedo alle turtle grigie [find_enemies ; trovate nemici ifelse any? enemies ; SE CI SONO NEMICI [set heading heading + 70 set speed speed + escape set color white] ; impostate in base a questi parametri l'orientamento ed il passo [find_friends ; SE NON CI SONO NEMICI... TROVA AMICI ifelse any? friends ; SE CI SONO AMICI... [find_nearest_friend ; trova l'amico pi� vicino let heada [heading] of nearest_friend ; leggi il suo orientamento let speeda [speed] of nearest_friend ; leggi la sua velocita let colora [color] of nearest_friend set imitation (fish_speed + escape) - speeda ifelse eastwest? [set heading heada + random-float (fish_speed + escape) - speeda ] [set heading heada - random-float (fish_speed + escape) - speeda ] set color colora ] ; ALTRIMENTI, SE NON CI SONO AMICI [ifelse eastwest? [set heading heading + random-float 15 ] [set heading heading - random-float 15]] ] ] ask turtles with [color = red] ; chiedo alle turtle rosse [set heading heading + random-normal 0 20 set speed random-float 0.3] end to-report eastwest? ; restituisce vero/falso in base al parametro [p] che viene "passato" nella procedura che richiama "to-report probability-fn? ifelse (random-float 100) < 50 ; se un numero a caso tra 0 e 1 � minore di p allora restituisci vero, altrimenti restitutisci falso [report true]; [report false] end to find_enemies set enemies other turtles in-cone visual_depth visual_angle with [color = red] end to find_friends set friends other turtles in-cone visual_depth 180 with [color = gray] end to find_nearest_friend;; turtle procedure set nearest_friend min-one-of friends [distance myself] end to plotagents set-current-plot "mean distance graph" set-current-plot-pen "Meandist" plot (mean [dist2] of turtles) end
There is only one version of this model, created almost 10 years ago by Nicola Lettieri.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Fish shoals.png | preview | Preview for 'Fish shoals' | almost 10 years ago, by Nicola Lettieri | Download |
This model does not have any ancestors.
This model does not have any descendants.