turtles-own [ chip? chip-color ] patches-own [ leaves ] to setup ca ask patches [ if random-float 100 < density [ set pcolor ((random colors) * 10) + 5 ] ] cct number [ set chip-color ((random colors) * 10) + 5 set color white set chip? false setxy random-float screen-size-x random-float screen-size-y ] end to go find-chip ;; find a wood chip and pick it up find-new-pile ;; find another wood chip find-empty-spot ;; find a place to put down wood chip end to find-chip if (chip-color = pcolor) ;; if wood-chip is my color [ stamp black ;; then pick up the chip set chip? true set color chip-color get-away stop ] wiggle find-chip end to find-new-pile if (pcolor = chip-color) [ stop ] fd 10 wiggle find-new-pile end to find-empty-spot if pcolor = black ;; if find a patch without a wood chip [ stamp chip-color ;; put down wood chip in patch set chip? false set color white fd 20 stop ] rt random-float 360 fd 1 find-empty-spot end to get-away rt random-float 360 back 10 if (pcolor = black) [ stop ] ;; exit this procedure if not on a pile get-away end to wiggle fd 1 rt (random-float 50 - random-float 50) 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, 2001. Updated 2002. ; ; To refer to this model in academic publications, please use: ; Wilensky, U. (1998). NetLogo Painted Desert Challenge model. ; http://ccl.northwestern.edu/netlogo/models/PaintedDesertChallenge. ; 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/PaintedDesertChallenge ; for terms of use. ; ; *** End of NetLogo Model Copyright Notice *** @#$#@#$#@ GRAPHICS-WINDOW 208 10 603 426 17 17 11.0 1 10 1 1 1 CC-WINDOW 208 428 593 533 Command Center BUTTON 108 42 198 75 go go T 1 T TURTLE NIL BUTTON 10 42 98 75 setup setup NIL 1 T OBSERVER T SLIDER 10 148 198 181 colors colors 1 14 8 1 1 NIL SLIDER 10 77 198 110 number number 1 400 100 1 1 NIL SLIDER 10 113 198 146 density density 0.0 99.0 45.0 1.0 1 % @#$#@#$#@ WHAT IS IT? ----------- This project is based on the model called Termites. In Termites, the agents follow a set of simple rules that results in them moving all of the wood chips into a single pile. Each termite starts wandering randomly. If it bumps into a wood chip, it picks the chip up, and continues to wander randomly. When it bumps into another wood chip, it finds a nearby empty space and puts its wood chip down. With these simple rules, the woodchips eventually end up in a single pile. Painted Desert Challenge adds the dimension of multiple types (colors) of wood chips. The challenge is to get the termites to sort each chip type into its own pile. HOW TO USE IT ------------- Click the SETUP button to set up the termites (white) and wood chips (all other colors). Click the GO button to start the simulation. A termite that is carrying a wood chip turns the color of the chip. The NUMBER slider controls the number of termites. (Note: Changes in the NUMBER slider do not take effect until the next setup.) The DENSITY slider controls the initial density of wood chips. The SIM-DELAY slider can be used to slow down the speed of the simulation. The PILES slider allows the user sets the number of different chip types (i.e., the number of different piles to be made). THINGS TO NOTICE ---------------- As piles of wood chips begin to form, the piles are not "protected" in any way. That is, termites sometimes take chips away from existing piles. That strategy might seem counter-productive. But if the piles were "protected", you would end up with lots of little piles, not one big one. The final piles are roughly round. Why is this? What other physical situations also produce round things? In general, the number of piles decreases with time. Why? Some piles disappear, when termites carry away all of the chips. And there is no way to start a new pile from scratch, since termites always put their wood chips near other wood chips. So the number of piles must decrease over time. (The only way a "new" pile starts is when an existing pile splits into two.) How do the termites know which color chip to take? This model assigns to each termite a variable that tells it which color chip to pick up. But, why do the termites sort the different types into discrete piles? Why don't they just make mixed groupings of chips? This project is a good example of a DECENTRALIZED strategy. There is no termite in charge, and no special pre-designated site for the piles. Each termite follows a set of simple rules, but the colony as a whole accomplishes a rather sophisticated task. THINGS TO TRY ------------- Do the results change if you use just a single termite? What if you use several thousand termites? Try changing the 'fd 10' command in the find-new-pile method. How does it affect the termites' behavior if the 'fd 10' becomes a 'forward 1', or is taken out altogether? When there are just two piles left, which of them is most likely to "win" as the single, final pile? How often does the larger of the two piles win? If one pile has only a single wood chip, and the other pile has the rest of the wood chips, what are the chances that the first pile will win? EXTENDING THE MODEL ------------------- Currently, the each termite 'belongs' to a chip type. Can you extend the model so that the a termite can pick up chips of any type, and yet still sort the chips into discrete piles? Plot the number of piles, or their average size, or the number of termites carrying wood chips, as the model runs. NETLOGO FEATURES ---------------- Notice that the wood chips do not exist as objects. They are just represented as colors in the patches. The termites update the patch colors as they pick up and put down the wood chips. In effect, the screen is being used as the data structure. This strategy is useful in many NetLogo programs. RELATED MODELS -------------- Termites, Shepherds CREDITS AND REFERENCES ------------------------ Resnick, M. & Wilensky, U. (1998). Diving into Complexity: Developing Probabilistic Decentralized Thinking through Role-Playing Activities. Journal of Learning Sciences, Vol. 7, No. 2. To refer to this model in academic publications, please use: Wilensky, U. (1998). NetLogo Painted Desert Challenge model. http://ccl.northwestern.edu/netlogo/models/PaintedDesertChallenge. 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/PaintedDesertChallenge for terms of use. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 @#$#@#$#@ NetLogo 2.0beta4 @#$#@#$#@ setup ask turtles [ repeat 50 [ go ] ] @#$#@#$#@ @#$#@#$#@