patches-own [chemical] to setup ca cct population [ set color red setxy (random-float screen-size-x) (random-float screen-size-y) ] ask patches [ set chemical 0 ] end to go ask turtles [ if (chemical > sniff-threshold) ;; only follow pheromone if there's enough beneath you [ turn-toward-chemical ] rt random-float wiggle-angle - random-float wiggle-angle + wiggle-bias fd 1 set chemical chemical + 2 ] ;; drop chemical onto patch diffuse chemical 1 ;; diffuse chemical to neighboring patches ask patches [ set chemical chemical * 0.9 ;; evaporate chemical set pcolor scale-color green chemical 0.1 3 ] ;; update display of chemical concentration end ;; turtle procedure -- examine the patch ahead of you and two ;; neighboring patches. turn in the direction of greatest chemical to turn-toward-chemical locals [myleft myright ahead] set ahead chemical-of patch-ahead 1 set myright chemical-of patch-right-and-ahead sniff-angle 1 set myleft chemical-of patch-left-and-ahead sniff-angle 1 ifelse ((myright >= ahead) and (myright >= myleft)) [ rt sniff-angle ] [ if (myleft >= ahead) [ lt sniff-angle ] ] ;; default: stay straight 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 1998 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, 2000. Updated 2003. ; ; To refer to this model in academic publications, please use: ; Wilensky, U. (1998). NetLogo Slime model. ; http://ccl.northwestern.edu/netlogo/models/Slime. ; 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/Slime ; for terms of use. ; ; *** End of NetLogo Model Copyright Notice *** @#$#@#$#@ GRAPHICS-WINDOW 212 10 579 398 25 25 7.0 1 10 1 1 1 CC-WINDOW 212 400 569 519 Command Center SLIDER 6 92 198 125 population population 1 400 150 1 1 NIL SLIDER 5 257 195 290 sniff-threshold sniff-threshold 0.0 5.0 1.0 0.1 1 NIL SLIDER 5 310 196 343 sniff-angle sniff-angle 0.0 180.0 45.0 1.0 1 degrees SLIDER 5 158 198 191 wiggle-angle wiggle-angle 0.0 45.0 40.0 1.0 1 degrees SLIDER 5 208 196 241 wiggle-bias wiggle-bias -40.0 40.0 0.0 1.0 1 degrees BUTTON 29 43 84 76 setup setup NIL 1 T OBSERVER T BUTTON 90 43 146 76 go go T 1 T OBSERVER T @#$#@#$#@ WHAT IS IT? ----------- This project is inspired by the aggregation behavior of slime-mold cells. It shows how creatures can aggregate into clusters without the control of a "leader." In this example, each turtle drops a chemical pheromone (shown in green). The turtles also "sniff" ahead, trying to follow the gradient of other turtles' chemicals. Meanwhile, the patches diffuse and evaporate the pheromone. Following these simple, decentralized rules, the turtles aggregate into clusters. HOW TO USE IT ------------- Click the SETUP button to set up a collection of slime-mold cells. Click the GO button to start the simulation. The POPULATION slider controls the number of slime mold cells in the simulation. Changes in the POPULATION slider do not have any effect until the next SETUP command. The next 4 sliders affect the way turtles move. Changes to them will immediately affect the model run. SNIFF-THRESHHOLD -- The minimum amount of chemical that must be present in a turtle's patch before the turtle will look for a chemical gradient to follow. This parameter causes the turtles to aggregate only when there are enough other cells nearby. The default value is 1.0. SNIFF-ANGLE -- The amount, in degrees, that a turtle turns to the left and right to check for greater chemical concentrations. The default value is 45. WIGGLE-ANGLE -- The maximum amount, in degrees, that a turtle will turn left or right in its random movements. When WIGGLE-ANGLE is set to zero, the turtle will remain at the same heading until it finds a chemical gradient to follow. The default value is 40. WIGGLE-BIAS -- The bias of a turtle's average wiggle. When WIGGLE-BIAS = 0, the turtle's average movement is straight ahead. When WIGGLE-BIAS > 0, the turtle will tend to move more right than left. When BIAS < 0, the turtle will tend to move more left than right. The default value is 0. There are several other critical parameters in the model that are not accessible by sliders. They can be changed by modifying the code in the procedures window. They are: - the evaporation rate of the chemical -- set to 0.9 - the diffusion rate of the chemical -- set to 1 - the amount of chemical deposited at each step -- set to 2 THINGS TO NOTICE ---------------- With 50 turtles, not much happens. The turtles wander around dropping chemical, but the chemical evaporates and diffuses too quickly for the turtles to aggregate. With 150 turtles, the result is quite different. When a few turtles happen (by chance) to wander near one another, they create a small "puddle" of chemical that can attract any number of other turtles in the vicinity. The puddle then becomes larger and more attractive as more turtles enter it and deposit their own chemicals. This process is a good example of positive feedback: the more turtles, the larger the puddle; and the larger the puddle, the more likely it is to attract more turtles. THINGS TO TRY ------------- Try different values for the SNIFF-THRESHHOLD, SNIFF-ANGLE, WIGGLE-ANGLE, and WIGGLE-BIAS sliders. How do they affect the turtles' movement and the formation of clumps? Change the SNIFF-ANGLE and WIGGLE-ANGLE sliders after some clumps have formed. What happens to the clumps? Try the same with SNIFF-THRESHOLD and WIGGLE-BIAS. EXTENDING THE MODEL ------------------- Modify the program so that the turtles aggregate into a single large cluster. How do the results change if there is more (or less) randomness in the turtles' motion? Notice that the turtles only sniff for chemical in three places: forward, SNIFF-ANGLE to the left, and SNIFF-ANGLE to the right. Modify the model so that the turtles sniff all around. How does their clustering behavior change? Modify the model so that the tutles sniff in even fewer places. How does their clustering behavior change? The NetLogo command "uphill" will be helpful here. What "critical number" of turtles is needed for the clusters to form? How does the critical number change if you modify the evaporation or diffusion rate? Can you find an algorithm that will let you plot the number of distinct clusters over time? NETLOGO FEATURES ---------------- Note the use of the PATCH-AHEAD, PATCH-LEFT-AND-AHEAD, and PATCH-RIGHT-AND-AHEAD primitives to do the "sniffing". RELATED MODELS -------------- Ants uses a similar idea of creatures that both drop chemical and follow the gradient of the chemical. CREDITS AND REFERENCES ---------------------- This model was developed at the MIT Media Lab. See Resnick, M. (1994) "Turtles, Termites and Traffic Jams: Explorations in Massively Parallel Microworlds." Cambridge, Ma: MIT Press. Adapted to StarLogoT, 1997, as part of the Connected Mathematics Project. Adapted to NetLogo, 2000, as part of the Participatory Simulations Project. To refer to this model in academic publications, please use: Wilensky, U. (1998). NetLogo Slime model. http://ccl.northwestern.edu/netlogo/models/Slime. 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/Slime for terms of use. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 arrow true 0 Polygon -7566196 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box true 0 Polygon -7566196 true true 45 255 255 255 255 45 45 45 circle true 0 Circle -7566196 true true 35 35 230 person false 0 Circle -7566196 true true 155 20 63 Rectangle -7566196 true true 158 79 217 164 Polygon -7566196 true true 158 81 110 129 131 143 158 109 165 110 Polygon -7566196 true true 216 83 267 123 248 143 215 107 Polygon -7566196 true true 167 163 145 234 183 234 183 163 Polygon -7566196 true true 195 163 195 233 227 233 206 159 spacecraft true 0 Polygon -7566196 true true 150 0 180 135 255 255 225 240 150 180 75 240 45 255 120 135 thin-arrow true 0 Polygon -7566196 true true 150 0 0 150 120 150 120 293 180 293 180 150 300 150 truck-down false 0 Polygon -7566196 true true 225 30 225 270 120 270 105 210 60 180 45 30 105 60 105 30 Polygon -8716033 true false 195 75 195 120 240 120 240 75 Polygon -8716033 true false 195 225 195 180 240 180 240 225 truck-left false 0 Polygon -7566196 true true 120 135 225 135 225 210 75 210 75 165 105 165 Polygon -8716033 true false 90 210 105 225 120 210 Polygon -8716033 true false 180 210 195 225 210 210 truck-right false 0 Polygon -7566196 true true 180 135 75 135 75 210 225 210 225 165 195 165 Polygon -8716033 true false 210 210 195 225 180 210 Polygon -8716033 true false 120 210 105 225 90 210 turtle true 0 Polygon -7566196 true true 138 75 162 75 165 105 225 105 225 142 195 135 195 187 225 195 225 225 195 217 195 202 105 202 105 217 75 225 75 195 105 187 105 135 75 142 75 105 135 105 @#$#@#$#@ NetLogo 2.0alpha2 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@