[Draft] Turlte Color Stop

[Draft] Turlte Color Stop preview image

1 collaborator

Default-person Pradeep Ankem (Author)

Tags

prisonbreak 

Tagged by Pradeep Ankem about 7 years ago

stop 

Tagged by Pradeep Ankem about 7 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0 • Viewed 265 times • Downloaded 20 times • Run 0 times
Download the '[Draft] Turlte Color Stop' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


ACKNOWLEDGMENT

This model is from Chapter Zero of the book "Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo", by Uri Wilensky & William Rand.

  • Wilensky, U. & Rand, W. (2015). Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.

This model is in the IABM Textbook folder of the NetLogo Models Library. The model, as well as any updates to the model, can also be found on the textbook website: http://www.intro-to-abm.com/.

WHAT IS IT?

This is a kind of mathematical investigation — we are investigating the emergent shape created by the movement of many turtles (arrows) moving independently in simple ways. Each turtle is moving a little step forward and taking a little turn right to stay on a circle of radius 20. What happens if the we slightly increase the step forward they are taking in mid-action? Guess before you try it.

HOW IT WORKS

We start with 40 turtles on a circle of radius 20 facing clockwise around the circle. The turtles move forward .35 units and turn right 1 degree to stay on the circle.

HOW TO USE IT

The SETUP button creates 40 turtles on a circle of radius 20 centered at the point (0 0). The turtles are all facing around the circle.

The GO button starts the turtles circling. They move around the circle.

The CHANGE-SPEED button increase the turtles' step size to .5 units. Before you do it, what is your guess as to what will happen when you change the step-size?

The TRACK-TURTLE button selects one turtle at random to draw its path, so you can keep better track of its movement.

THINGS TO NOTICE

What is happening to the shape described by the turtles?

How far out do the turtles go?

How far in do they come?

THINGS TO TRY

In the Command Center, try the command lt 50 while the turtles are circling. Is this the same behavior as you observed when changing the speed?

Get a single (or several) turtles to trace their path using the command pen-down (pd). This may help to show the relationship between the movement of individual turtles and the circle you see as they all move together.

EXTENDING THE MODEL

What tools can you build to help visualize what is going on?

Can you add a plot to show a turtle's distance from the origin as the turtles circle?

Can you stop all the turtles and focus on only one turtle's movement?

Can you draw a circle (with a turtle's pen) on the screen to serve as a baseline?

Make sliders to control the original radius and/or the number of turtles.

RELATED MODELS

This model is a simplification of the Turtles Circling Model in the Mathematics section of the NetLogo models library.

CREDITS AND REFERENCES

This model is a simplified version of:

HOW TO CITE

This model is part of the textbook, “Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo.”

If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:

Please cite the textbook as:

  • Wilensky, U. & Rand, W. (2015). Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.

COPYRIGHT AND LICENSE

Copyright 1997 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

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

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

turtles-own [speed]

to patch-draw
  if mouse-down?     ;; reports true or false to indicate whether mouse button is down
    [
      ;; mouse-xcor and mouse-ycor report the position of the mouse --
      ;; note that they report the precise position of the mouse,
      ;; so you might get a decimal number like 12.3, but "patch"
      ;; automatically rounds to the nearest patch
      ask patch mouse-xcor mouse-ycor
        [ set pcolor red
          display ]
    ]
end 

to setup
  setup-circle
  reset-ticks
end 

to setup-circle
  clear-all
  set-default-shape turtles "bug"
  ;; turtles should be evenly spaced around the circle
  crt 10 [
    set size 2  ;; easier to see
    set speed .35  ;; this is the size of each step the turtles take in a tick
    fd random 20  ;; move turtles to perimeter of circle
    rt random 90
    ;;fd random 40
    ;;lt random 40
      ;; turtles face tangent to the circle
  ]
end 

to go
  ;;ask patch 3 -4 [ set pcolor green ]
  ;;ask patch 4 -4 [ set pcolor green ]
  ;;ask patch 5 -4 [ set pcolor green ]

  ;; move forward then turn
  ;;ask turtles [if ticks >= 100 [stop]]
  ask turtles [if pcolor = blue [stop] fd speed rt 1 ]
  ;;ask turtles [fd random 10]
  ;;ask-concurrent turtles [
    ;;fd 1
  ;;]
  ;;ask turtles [pen-down]

  tick
end 

to change-speed
  ask turtles [set speed speed + .15]   ;; increase the step-size to .5
end 

to setup-center
  ;;clear-all
  ;; set halfedge as edge divided by two. in case edge is an odd number,
  ;; halfedge get the integer value of the division.
  let halfedge int (edge / 2)
  ask patches [
    ;; if patches are between (-halfedge,-halfedge) to (-halfedge,halfedge)...
    if pxcor = (- halfedge) and pycor >= (- halfedge) and pycor <= (0 + halfedge)
      [ set pcolor blue ]                                ;; ... draws left edge in blue
    ;; if patches are between (halfedge,-halfedge) to (halfedge,halfedge)...
    if pxcor = (0 + halfedge) and pycor >= (- halfedge) and pycor <= (0 + halfedge)
      [ set pcolor blue ]                                ;; ... draws right edge in blue
    ;; if patches are between (-halfedge,-halfedge) to (halfedge,-halfedge)...
    ;;if pycor = (- halfedge) and pxcor >= (- halfedge) and pxcor <= (0 + halfedge)
      ;;[ set pcolor blue ]                                ;; ... draws bottom edge in blue
    ;; if patches are between (-halfedge,halfedge) to (halfedge,halfedge)...
    if pycor = (0 + halfedge) and pxcor >= (- halfedge) and pxcor <= (0 + halfedge)
      [ set pcolor blue ]                                ;; ... draws upper edge in blue
  ]
  reset-ticks
end 

; Copyright 1997 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created about 7 years ago by Pradeep Ankem.

Attached files

File Type Description Last updated
[Draft] Turlte Color Stop.png preview Preview for '[Draft] Turlte Color Stop' about 7 years ago, by Pradeep Ankem Download

This model does not have any ancestors.

This model does not have any descendants.