MyxococusVsEColi
Model was written in NetLogo 6.0.2
•
Viewed 113 times
•
Downloaded 15 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
turtles-own[nearest-neighbour-coli nearest-neighbour-cocos neighbours-coli neighbours-cocos] breed [mixococos mixococo] breed [ecolis ecoli] to setup clear-all reset-ticks ask patches [set pcolor cyan] create-mixococos 10000 [set shape "circle" set color red - 2 setxy random-xcor random-ycor ] create-ecolis 100000 [set shape "circle 2" set color red setxy random-xcor random-ycor] end to go ask ecolis [cluster-coli move] ask mixococos [cluster-cocos move]; eat ] ;tick end to move ; rt random-float 360 fd 1 end to-report average-heading-towards-neighbours-coli ;; turtle procedure ;; "towards myself" gives us the heading from the other turtle ;; to me, but we want the heading from me to the other turtle, ;; so we add 180 ifelse any? other ecolis in-radius 5[ let x-component mean [sin (towards myself + 45)] of neighbours-coli let y-component mean [cos (towards myself + 45)] of neighbours-coli ifelse x-component = 0 and y-component = 0 [ report heading ] [ report atan x-component y-component ]][report heading] end to-report average-heading-towards-neighbours-cocos ;; turtle procedure ;; "towards myself" gives us the heading from the other turtle ;; to me, but we want the heading from me to the other turtle, ;; so we add 180 ifelse any? other mixococos in-radius 5[ let x-component mean [sin (towards myself + 45)] of neighbours-cocos let y-component mean [cos (towards myself + 45)] of neighbours-cocos ifelse x-component = 0 and y-component = 0 [ report heading ] [ report atan x-component y-component ]][report heading] end to cluster-coli set neighbours-coli other ecolis in-radius 5 ;set neighbours-cocos other mixococos in-radius 5 set nearest-neighbour-coli min-one-of neighbours-coli [distance myself] ;set nearest-neighbour-cocos min-one-of neighbours-cocos [distance myself] turn-towards average-heading-towards-neighbours-coli 45 end to cluster-cocos ;set neighbours-coli other ecolis in-radius 5 set neighbours-cocos other mixococos in-radius 5 ;set nearest-neighbour-coli min-one-of neighbours-coli [distance myself] set nearest-neighbour-cocos min-one-of neighbours-cocos [distance myself] turn-towards average-heading-towards-neighbours-cocos 45 end to turn-towards [new-heading max-turn] ;; turtle procedure turn-at-most (subtract-headings new-heading heading) max-turn end to turn-away [new-heading max-turn] ;; turtle procedure turn-at-most (subtract-headings heading new-heading) max-turn end to turn-at-most [turn max-turn] ;; turtle procedure ifelse abs turn > max-turn [ ifelse turn > 0 [ rt max-turn ] [ lt max-turn ] ] [ rt turn ] end to eat let prey one-of ecolis in-radius 2 ;turn-towards average-heading-towards-neighbours-coli 45 if prey != nobody [ ask prey [ die ] ];[cluster-cocos move] end
There is only one version of this model, created over 5 years ago by Augusto Cabrera-Becerril.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
MyxococusVsEColi.png | preview | Preview for 'MyxococusVsEColi' | over 5 years ago, by Augusto Cabrera-Becerril | Download |
This model does not have any ancestors.
This model does not have any descendants.