turtles-own [ dist ] to setup setup-circle radius number setup-plot end to setup-circle [ r n ] ca set-default-shape turtles "turtle" cct n [ set size 3 fd r set heading atan ycor (- xcor) ] end to setup-plot set-current-plot "Distance from the origin" set-plot-y-range 0 screen-edge-x end to all-circle circle radius end to circle [ r ] ask turtles [ fd ( pi * r / 180 ) * ( speed / 50 ) rt speed / 50 set dist distancexy 0 0 ] if plot? [ plot-distance 0 ] end to move-along-circle [ r ] fd ( pi * r / 180 ) * ( speed / 50 ) wait .1 rt speed / 50 set dist distancexy 0 0 end to zero-circle ask turtle 0 [ pd move-along-circle radius ] end to patch-circle [ r ] if ( ( distancexy 0 0 ) < ( r + .5 ) ) and ( ( distancexy 0 0 ) > ( r - .5 ) ) [ set pcolor white ] end to plot-distance [ id ] plot dist-of turtle id end to draw-circle patch-circle draw-rad end ; *** NetLogo Model Copyright Notice *** ; ; This model was created as part of the project: CONNECTED MATHEMATICS: ; MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL ; MODELS (OBPML). The project gratefully acknowledges the support of the ; National Science Foundation (Applications of Advanced Technologies ; Program) -- grant numbers RED #9552950 and REC #9632612. ; ; Copyright 1997 by 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 model was converted to NetLogo as part of the project: ; PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN ; CLASSROOMS. The project gratefully acknowledges the support of the ; National Science Foundation (REPP program) -- grant number REC #9814682. ; Converted from StarLogoT to NetLogo, 2001. Updated 2002. ; ; To refer to this model in academic publications, please use: ; Wilensky, U. (1997). NetLogo Turtles Circling model. ; http://ccl.northwestern.edu/netlogo/models/TurtlesCircling. ; Center for Connected Learning and Computer-Based Modeling, ; Northwestern University, Evanston, IL. ; ; In other publications, please use: ; Copyright 1998 by Uri Wilensky. All rights reserved. See ; http://ccl.northwestern.edu/netlogo/models/TurtlesCircling ; for terms of use. ; ; *** End of NetLogo Model Copyright Notice *** @#$#@#$#@ GRAPHICS-WINDOW 266 10 639 404 60 60 3.0 1 10 1 1 1 CC-WINDOW 266 409 633 526 Command Center BUTTON 3 79 95 112 all-circle all-circle T 1 T OBSERVER T SLIDER 97 117 260 150 radius radius 0.0 50.0 20.0 1.0 1 NIL SLIDER 97 79 260 112 speed speed 0.0 100.0 25.0 1.0 1 NIL SLIDER 97 42 260 75 number number 1 300 100 1 1 NIL BUTTON 2 42 95 75 setup setup NIL 1 T OBSERVER T BUTTON 4 154 95 187 draw-circle draw-circle NIL 1 T PATCH T SLIDER 97 154 261 187 draw-rad draw-rad 0.0 50.0 20.0 1.0 1 NIL SWITCH 84 388 184 421 plot? plot? 1 1 -1000 BUTTON 4 117 95 150 zero-circle zero-circle T 1 T OBSERVER T PLOT 9 194 260 386 Distance from the origin time dist 0.0 1440.0 0.0 30.0 true false PENS "distance" 1.0 0 -11352576 true @#$#@#$#@ WHAT IS IT? ----------- This is a new kind of mathematical investigation -- we are investigating the emergent shape created by the movement of many turtles moving independently in simple ways. Each turtle is moving so as to create a circle of a fixed radius (set by the RADIUS slider). They create their circles by moving forward a little and turning right a little so as to end up with a circle of the specified radius. We start all the turtles on a circle of that radius so they move around the circle. What happens if the radius they are all circling at is changed in mid-action? Guess before you try it. HOW TO USE IT ------------- The NUMBER slider determines the number of turtles circling. The RADIUS slider determines the size of the circle each turtle moves on. The SPEED slider determines how large a step each turtle take at each clock tick -- it determines the speed of circling. The SETUP button creates NUMBER turtles on a circle of radius RADIUS centered at the point (0 0). The turtles are all headed so as to move around the circle. The ALL-CIRCLE button starts the turtles circling. They are each drawing their own circle of radius RADIUS. Change the value of the RADIUS slider while the turtles are circling. BEFORE you do it, what is your guess as to what will happen when you change the RADIUS? 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 ------------- Try different values of both starting radius and changed radius. You can also do further investigations with the following controls: The ZERO-CIRCLE button lets you just focus on turtle zero's movement -- all the rest are stopped. The DRAW-CIRCLE button lets you draw a circle on the patches with a radius equal to DRAW-RAD. This way you can strack the movement of the turtles. If the PLOT? switch is on, the plot will show a plot of turtle zero's distance from the origin as the turtles circle. Try the command LT 50 while the turtles are circling. Is this the same behavior as you observed when changing the radius? In the Command Center, get a single (or several) turtles to trace their path using the command pendown (pd). This may help to show the relationship between the circles 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? NETLOGO FEATURES ---------------- Notice the behavior of the NetLogo function ATAN. It gives positive values for x positive, so it is necessary to multiply x by -1 in order to get the tangent angles for the circle. CREDITS AND REFERENCES ---------------------- To refer to this model in academic publications, please use: Wilensky, U. (1997). NetLogo Turtles Circling model. http://ccl.northwestern.edu/netlogo/models/TurtlesCircling. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. In other publications, please use: Copyright 1997 by Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/TurtlesCircling for terms of use. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 turtle true 0 Circle -7566196 true true 60 59 181 Circle -7566196 true true 124 1 57 Circle -7566196 true true 98 80 8 Circle -7566196 true true 89 55 31 Circle -7566196 true true 179 56 30 Circle -7566196 true true 92 214 32 Circle -7566196 true true 172 216 33 @#$#@#$#@ NetLogo 2.0beta4 @#$#@#$#@ setup set radius 40 repeat 210 [ all-circle ] @#$#@#$#@ @#$#@#$#@