Follower 3D

Follower 3D preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

follower 3d 

Tagged by Qian li about 10 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 3D 4.1pre7 • Viewed 384 times • Downloaded 32 times • Run 0 times
Download the 'Follower 3D' 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?

This is a 3D version of the Follower model found in the Art section of the Sample Models. In Follower, turtles attempt to "connect" with other turtles, forming long chains according to a small set of simple rules.

In the model, a turtle can follow only ONE other turtle, and similarly it can only be followed by ONE other turtle. This means there are four turtle states, each represented by a different color:

Pink: Unattached

Green: Following another turtle (a "tail")

Yellow: Being followed by another turtle (a "head")

Blue: Following and being followed by other turtles (a "body" segment)

Turtles are created in the pink (unattached) state. At each turn, each turtle checks a random patch in a square donut shape around itself. If it finds a turtle there who is not already being followed, it will "latch on" and start following the movements of that turtle. An unattached turtle (one that has not yet "latched on" to another turtle) will move randomly.

HOW TO USE IT

SETUP: Clears the world and creates the number of turtles specified in the NUM-TURTLES slider. All the turtles are created in an unattached state (pink).

GO: Runs the simulation.

NUM-TURTLES: Specifies the number of turtles created in SETUP.

NEAR-RADIUS: The inner radius of the square donut turtles search in.

FAR-RADIUS: The outer radius of the square donut turtles search in.

WAVER: The amount of randomness in the movement of non-following turtles.

There is also a plot called "Turtle Count" that displays, over time, the number of turtles in each state. You can turn the plot on and off with the PLOT? switch.

FOLLOW ONE-OF TURTLES: selects a random turtle and follows it.

THINGS TO NOTICE

Each of the sliders has a different effect on the simulation.

Notice that the when the number of turtles is high, chains tend to form very quickly. This is because there are more turtles and therefore more chances for each turtle to attach on each turn.

Varying the size of the donut tends to affect how the turtles start to attach, but in the long run doesn't have a big effect on the simulation outcome. Donut size is most interesting at very small values, which causes the turtles to attach into very small loops. Also, very large thick donuts (big FAR-RADIUS, small NEAR-RADIUS) looks interesting with a large number of turtles.

The amount of movement randomness (set by WAVER) can also change the simulation outcome. Very high values for WAVER result in small loops being formed because the turtles are continuously moving over themselves, increasing the chances of connecting the head of the chain to its tail.

The simulation, under any parameters, moves towards forming loops. Loops may be formed by wrapping around the screen, but in almost all cases if the simulation is left running long enough you will get many small loops or one big loop. It is possible that a chain will never connect to itself if the WAVER slider is set to zero, but otherwise the simulation should proceed towards loops.

THINGS TO TRY

Try making the waver setting very high. Notice how the turtles clump up into little clusters. This is because they are moving over themselves frequently, which increases the chances of attaching to their tail. This makes sense if the donut allows the turtles to check close to themselves, but if it does not (NEAR-RADIUS is big) then the same thing still happens. Why is this the case?

Notice that we are plotting all four possible turtle states, but only three appear on the plot. Do you know why?

EXTENDING THE MODEL

Try implementing different rules for how turtles follow each other.

You might also try giving the turtles a certain probability of breaking apart again. See how this affects the patterns they make.

NETLOGO FEATURES

Note the use of the "towards" and "towards-pitch" primitives to make the turtles follow each other.

Note also that we must be very careful to ensure that we never have two turtles following the same leader.

HOW TO CITE

If you mention this model in an academic publication, we ask that you include these citations for the model itself and for the NetLogo software:

- Wilensky, U. (1998). NetLogo Follower 3D model. http://ccl.northwestern.edu/netlogo/models/Follower3D. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

In other publications, please use:

- Copyright 1998 Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/Follower3D for terms of use.

COPYRIGHT NOTICE

Copyright 1998 Uri Wilensky. All rights reserved.

Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed:

a) this copyright notice is included.

b) this model will not be redistributed for profit without permission from Uri Wilensky. Contact Uri Wilensky for appropriate licenses for redistribution for profit.

This is a 3D version of the 2D model Follower.

This model was created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

Comments and Questions

Click to Run Model

turtles-own [
  leader    ;; the id number of the turtle this turtle is following,
            ;; or nobody if not following
  follower  ;; the id number of the turtle that is following this turtle,
            ;; or nobody if not being followed
]

to setup
  clear-all
  crt num-turtles
    [ set color pink
      setxyz random-float world-width
             random-float world-height
             random-float world-depth
      set leader nobody
      set follower nobody ]
  setup-plot
  plot-turtles
end 

to go
  ask turtles
    [ if leader = nobody
        [ attach-turtle ]
      move-turtle ]
  tick
  plot-turtles
end 

to attach-turtle  ;; turtle procedure
  ;; find a random patch to test inside the donut
  let xd near-radius + random (far-radius - near-radius)
  let yd near-radius + random (far-radius - near-radius)
  let zd near-radius + random (far-radius - near-radius)
  if random 2 = 0 [ set xd (- xd) ]
  if random 2 = 0 [ set yd (- yd) ]
  if random 2 = 0 [ set zd (- zd) ]
  ;; check for free turtles on that patch
  let other-turtle one-of (other turtles-at xd yd zd) with [follower = nobody]
  ;; if we didn't find a suitable turtle, stop
  if other-turtle = nobody [ stop ]
  ;; we're all set, so latch on!
  ask other-turtle [ set follower myself ]
  set leader other-turtle
  ;; change our color
  ifelse follower = nobody
    [ set color lime ]
    [ set color sky
      set shape "line" ]
  ;; change our leader's color
  ask other-turtle
    [ ifelse leader = nobody
        [ set color yellow ]
        [ set color sky
          set shape "line" ] ]
end 

to move-turtle  ;; turtle procedure
  ;; if we are still unattached...
  ifelse leader = nobody
    ;; do a somewhat random glide
    [ right random-float waver - random-float waver
      tilt-up random-float waver - random-float waver ]
    ;; otherwise follow the leader
    [
      ;; if leader is directly above or below us, we can't calculate heading
      if xcor != [xcor] of leader or ycor != [ycor] of leader
        [ set heading towards leader ]
      set pitch towards-pitch leader
    ]
  fd 1
end 

to setup-plot
  set-current-plot "Turtle Count"
  set-plot-y-range 0 num-turtles
end 

to plot-turtles
  if not plot? [ stop ]
  set-current-plot-pen "unattached"
  plot count turtles with [color = pink]
  set-current-plot-pen "heads"
  plot count turtles with [color = yellow]
  set-current-plot-pen "bodies"
  plot count turtles with [color = sky]
  set-current-plot-pen "tails"
  plot count turtles with [color = lime]
end 


; Copyright 1998 Uri Wilensky. All rights reserved.
; The full copyright notice is in the Information tab.

There are 3 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Follower 3D Download this version

Attached files

File Type Description Last updated
Follower 3D.png preview Preview for 'Follower 3D' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.