MyxococusVsEColi

MyxococusVsEColi preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.2 • Viewed 261 times • Downloaded 35 times • Run 0 times
Download the 'MyxococusVsEColi' modelDownload this modelEmbed this model

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

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 about 6 years ago by Augusto Cabrera-Becerril.

Attached files

File Type Description Last updated
MyxococusVsEColi.png preview Preview for 'MyxococusVsEColi' about 6 years ago, by Augusto Cabrera-Becerril Download

This model does not have any ancestors.

This model does not have any descendants.