lissajous-2


Information

Created with NetLogo version NetLogo 3.0.2
Running with NetLogoLite.jar version 302.



Procedures

NetLogo Version: NetLogo 3.0.2

globals 
[ t ox oy cyc oc
]

turtles-own
[ tt
  lead
]

to setup
   ca
   cct 1
   [ home
     set shape "default"
     set heading 0
     set color gray
     set tt 0
     set lead self
     pd
   ]
   ;;;   cct tail
   ;;;   [ home
   ;;;     set shape "circle"
   ;;;     set heading 0
   ;;;     set color gray
   ;;;     set lead turtle (who - 1)
   ;;;     set tt tt-of lead + t-delta
   ;;;     pu
   ;;;   ]
end

to go
   ;;;   let pop count turtles - 1
   ;;;   ifelse pop > tail 
   ;;;   [ ask max-one-of turtles [ who ] [ die ] ]
   ;;;   [ if pop < tail
   ;;;     [ cct 1
   ;;;       [ home
   ;;;         set shape "circle"
   ;;;         set heading 0
   ;;;         set color gray
   ;;;         set lead turtle (who - 1)
   ;;;         set tt tt-of lead + t-delta
   ;;;         set color color-of lead + c-inc
   ;;;         pu
   ;;;       ]
   ;;;     ]
   ;;;   ]
   ask turtle 0
   [ let ot t-delta
     if abs (ox - xcor ) > 1 or abs (oy - ycor ) > 1
     [ set t-delta t-delta - .001 ]
     if abs (ox - xcor ) < .01 and abs (oy - ycor ) < .01 
     [ set t-delta t-delta + .01 ]
   ;;;     if ot != t-delta
   ;;;     [ ask turtles with [ self != myself ]
   ;;;       [ set tt tt-of lead + t-delta 
   ;;;       ]
   ;;;     ]
   ;;;     if oc != c-inc
   ;;;     [ set oc c-inc
   ;;;       ask turtles with [ self != myself ]
   ;;;       [ set color color-of lead + c-inc ]
   ;;;     ]
     set ox xcor
     set oy ycor
   ]

   ask turtles
   [ set tt tt + t-delta
     set color color + c-inc
     setxy  (screen-edge-x * sin(w * tt ) )
            (screen-edge-y * sin tt )
     
   ]
end

     

                    


Download Link

View or download the complete model file (to download: right-click, save-link-as):
-- Download lissajous-2 --