chain-of-fools_2009


Information

Created with NetLogo version NetLogo 4.0.4
Running with NetLogoLite.jar version 404.


SUMMARY


Linked chains follow each other.

WHAT IS IT?


A simple model. A chain of linked turtles. They follow each other. That is, each link as a "leader". Each link steps toward its leader, until it is some minimum distance, if the leader is too close, the link steps away at a preset angle.
Use the sliders and switches to vary the rules that are used.
Some interesting effects emerge, especially with many links.

THE CONTROLS


pop| - how many links in the chain. can not be changed during GO.
min-dist| - the closest that links want to get
when 'scale-with-min-dist' is on,
size-factor is multiplied by this value.
step-size| - how far a link moves each step
smaller values make for smoother movement,
but experiement with larger values too:
interesting effects emerge.
avoid-heading| - the angle added to the current heading
when the lead is too close
size-factor| - the base size of the links.
scale-with-min-dist| - when on, the size is scaled by min-dist.
for links that seem to be connected, turn this on,
then set size-factor to 2.
double-correct| - after turning away and stepping forward or backward,
turn back by the same amount
shape-choice| - choose the shape to use for the chain.
different shapes reveal different information about the chain:

  • lines show the way angles change

  • circle hides the chaning angles, but lets one focus on the chain as a whole.

  • dotted-vector accentuates the curvyness of a shape.
  • |frame-skip| - model skips displaying this many frames. speeds things up,
    can hide complexity for rapidly evolving shapes,
    can use to freeze-frame repeating shapes, and determine the cycles

    THINGS TO LOOK FOR


    when a link wraps across an edge, the result is usually that the follower turns and crosses the screen to get back to it. this can keep a chain system unstable.

  • some chain systems will stabilize given enough room and time

  • some will shrink/expand into a circle

  • some never calm down

  • some seem stable for awhile (especially larger chains) then suddenly shift.

  • note that often the overall *shape* is fairly stable, even though the individual

  • members are racing around and around the perimiter.
  • NETLOGO FEATURES



  • Well chosen shapes can expose information.

  • Using nodisplay and display to control screen-redrawing

  • Storing turtles in a turtle variable creates linked turtles

  • turtle scaling strongly affects execution speed.
  • XML Tags


    <info>
    <summary>Linked objects follow each other, endlessly.</summary>
    <copy>Copyright (C) 2004,2009 James P. Steiner</copy>
    </info>

    Procedures

    NetLogo Version: NetLogo 4.0.4

    ;; SUMMARY
    globals
    [ old-shape
      change-shape?
      frames
    ]
    
    Turtles-own [ next base-color direction ]
    
    to startup
       setup
    end
       
    To setup
      Ca
      ;; Assign each turtle to follow the next-highest turtle
      crt pop
      [ set next turtle ( (who + 1) mod pop)
        rt random 360
        jump max-pxcor
        set shape shape-choice
        ;; rainbow colors
        set base-color hsb (255 * who / (pop + 1)) 255 255
        set color base-color
        ]
        tick
    End
    
    To go
      if not any? turtles [ setup ]
      if [ shape ] of turtle 0 != shape-choice
      [ ask turtles [ set shape shape-choice ]
      ]
      ifelse scale-with-min-dist?
      [ let new-size min-dist * size-factor
        ask turtles with [ size != new-size ]
        [ set size new-size ]
      ]
      [ let new-size size-factor
        ask turtles with [ size != new-size ]
        [ set size new-size ]
      ]
      ifelse unicolor?
      [ if [color != blue ] of turtle 0      [ ask turtles [ set color blue ] ] ]
      [ if [color != base-color] of turtle 0 [ ask turtles [ set color base-color ] ] ]
      ask turtles
      [ ;; if my next is too close
        ifelse distance-nowrap next <= min-dist
        [ ;; turn towards it, and away a little bit
          face-nowrap next
          rt avoid-heading
          ;; jump
          jump step-size
        ]
        [ ; if not to close, just turn-towards and step-forward
          face-nowrap next 
          jump step-size
        ]
      ]
      tick
    End
    
                        


    Download Link

    View or download the complete model file (to download: right-click, save-link-as):
    -- Download chain-of-fools_2009 --