WHAT IS IT? ----------- This model is an extension of a previous StarLogo project called "Kaleidoscope". The current version has added six new patterns. The name of this model is called Geometron-Top-Down. HOW TO USE IT ------------- Set NTURTLES to a desired value between 0 and 360 (default value is 20). NTURTLES determines how many initial turtles you want to start out with. These initial turtles will spawn other shape-making turtles. Set COLOR-SEP to a desired value between 0 and 60 (default value is 12). COLOR-SEP determines the range of colors that the turtles (and hence the kaleidoscope) will take on. The higher the value, the smaller the range. When you have set COLOR-SEP and NTURTLES, press the SETUP button to set-up the model. Next, choose a pattern. In each pattern, the initial turtles hatch other turtles and those hatched turtles draw different geometric shapes. Each pattern is represented by a forever button. The user cannot change PATTERN-2, PATTERN-4 or PATTERN-6. PATTERN-1, PATTERN-3, and PATTERN-5, however, allow for user control using the DIRECTION and EXPANDER sliders. For detailed descriptions of the instructions in each pattern, go to the end of the info-window. The slider DIRECTION (default value is 2) is designed for PATTERN-1 and PATTERN-3. At each cycle, DIRECTION determines the amount that the pattern-making turtles turn to the right. In other words, if DIRECTION is set to 12, each turtle will turn 12 degrees to the right before moving forward. The slider EXPANDER is designed specifically for pattern 5 (default value is 80). At each cycle of PATTERN-5, EXPANDER determines how large each leg of the polygon will be. The user also has control over the color distribution exhibited by each pattern. The COLOR-SHIFT button will continuously increase or decrease the value of 'curr-color-sep' by a small random amount. (Thus the slider value itself isn't changed, but the color value of the turtle is.) The INC-DEC-COLOR switch determines if 'curr-color-sep' is increased or decreased. Other added features of the model are the CLEAR-PATCHES-LIFT-PEN and RESTORE buttons. CLEAR-PATCHES-LIFT-PEN does exactly what it says: it clears the screen of all patches, lifts the pen on all turtles and kills all turtles greater than NTURTLES. RESTORE kills all turtles greater than NTURTLES and tells all turtles to put their pen down. Killing all turtles greater than NTURTLES restores the original number of turtles on the screen. A useful tool that can be used in conjunction with the CLEAR-PATCHES-LIFT-PEN and RESTORE buttons is a switch called FOLLOW-TURTLE. When you CLEAR-PATCHES-LIFT-PEN, you see the skeleton of the pattern since the turtles are moving without their pen down. But when the switch is turned on, one hatched turtle will put its pen down. However, since turtles are constantly being born and dying it may take time for this particular turtle to appear. It should also be understood that because some of the patterns divide the turtles into different groups and assign them different shapes to create, more than one turtle may be told to put its pen down in order to represent what all the turtles in the pattern are doing. Two monitors are provided at the bottom of the Interface Window. COUNT-TURTLES displays the current number of turtles on the graphics window. Likewise, CURR-COLOR-SEP displays that variable's value, so that you know when it has been altered, and by how much. THINGS TO NOTICE ---------------- An important thing to notice here is the number given in COUNT-TURTLES. Right away, it becomes much larger than NTURTLES, but quickly settles on some nice big number. Take a look at the Procedures Window. Initially, upon setup, there are NTURTLES turtles. Once one of the pattern buttons is pressed, each of these turtles repeatedly hatches a new turtle and turns by a specified degree. It is important to understand that this phenomenon, the fact that initial NTURTLES is exploding into a number much larger than NTURTLES is because other turtles are being hatched in between the time a single turtle is hatched and the time it finishes drawing its given shape. Thus, if we were to add a wait statement into one of the patterns, not as many turtles could be hatched. In other words, the number of turtles greater than NTURTLES would decrease. As turtles execute their commands much quicker than the hatched turtles, they produce many turtles during one loop of a pattern; eventually, though, turtles start to die off. At this point, the number of turtles who are born is roughly equal to the number who die at any given step. You also should notice how COLOR-SEP (known in the code as 'curr-color-sep') alters the appearance of the pattern. Turn COLOR-SHIFT on, and let 'curr-color-sep' become very large. Then watch what happens when it is small, maybe zero or some negative number. THINGS TO TRY ------------- Try playing around with the DIRECTION slider on PATTERN-1 AND PATTERN-3 and the EXPANDER slider on PATTERN-5. Observe what happens to the pattern as you change the values of each. GEOMETRON-TOP-DOWN is meant to be a visually pleasing model just to watch. See what different values of COLOR-SEP produce, and explore how COLOR-SHIFT changes the appearance of the kaleidoscope. What seems the best to you? Try changing the code in the Procedures Window. Increase the size of the shapes drawn by each of the turtles, or try changing the size of the angle each of the turtles turns through. Instead of each turtle moving or turning a given amount, what about having it move a small random amount (as in the changes to curr-color-sep from COLOR-SHIFT). How much randomness can you add to 'kaleidoscope' and still maintain some kind of overall structure? After running one of the patterns, try changing the number of NTURTLES and then stop the pattern and push CLEAR-PATCHES-LIFT-PEN. Then start the pattern again. What happens? Can you explain why this happens? EXTENDING THE MODEL ------------------- Whenever a turtle is hatched by one of NTURTLES, it proceeds to draw a certain pattern. Change the 'hatch' command list so that it draws some other shape or pattern. Try to predict what overall shape will emerge. Try to write an entirely new kind of GEOMETRON-TOP-DOWN project. In the current project, turtles spin off from a center core of NTURTLES turtles. In your new project, maybe the drawing turtles could orbit around some fixed (or moving) point-look at the StarLogo projects 'n-bodies' and 'gravitation'. STARLOGOT FEATURES ----------------- GEOMETRON-TOP-DOWN makes nice use of the turtle primitive 'hatch'. Whenever a turtle is hatched, it executes the command list that follows the 'hatch' command. Generally all it does is change its color or alter some variable- there's no reason it can't run some other, possibly lengthy, procedure. (Which is exactly what happens here.) NOTES ON THE SHAPES --------------- The following is a list of all the basic shape functions that are used in this model to create the six patterns. It is important to understand that the complexity of the patterns are actually nothing more than different combinations of these shape functions. For example, pattern-1 utilizes the rigth-shape and left-shape functions. Both these functions simply draw circles. However, by adding slight variations to what the turtle does and which ones do it, it is possible to create the pattern that is represented by pattern-1. This, in fact, is the basic algorithm that the model uses in order to create all the patterns. Take the basic shape functions, add slight variations to what the turtles do and choose which turtles do it. RIGHT-CIRCLE ----------- Performs the following procedure 180 times: Move forward 1.5 steps and turn right by 2 degrees. To see the shape that this function creates, try calling it in the command center with one turtle with the pen down. A turtle will create a circle heading in the right direction. LEFT-CIRCLE ----------- Performs the following procedure 180 times: Move forward 1.5 steps and turn left by 2 degrees. To see the shape that this function creates, try calling it in the command center with one turtle with the pen down. A turtle will create a circle heading in the left direction. LEFT-SQUARE ----------- Performs the following procedure 4 times: Move forward EXPANDER steps and turn right by 90 degrees. To see the shape that this function creates, try calling it in the command center with one turtle with the pen down. A turtle will create a square heading in the left direction. RIGHT-TRIANGLE -------------- Performs the following procedure 3 times: Move forward 35 steps and turn right by 120 degrees. To see the shape that this function creates, try calling it in the command center with one turtle with the pen down. A turtle will create a triangle heading in the right direction. OCTAGON -------- Performs the following procedure 8 times: Move forward 30 steps and turn right by 45 degrees. To see the shape that this function creates, try calling it in the command center with one turtle with the pen down. A turtle will create an octagon heading in the right direction. PENTAGON --------- Performs the following procedure 5 times: Move forward 35 steps and turn right by 72 degrees. To see the shape that this function creates, try calling it in the command center with one turtle with the pen down. A turtle will create a pentagon heading in the right direction. HEXAGON -------- Performs the following procedure 6 times: Move forward 30 steps and turn right by 60 degrees. To see the shape that this function creates, try calling it in the command center with one turtle with the pen down. A turtle will create a hexagon heading in the right direction. NINE-GON --------- Performs the following procedure 9 times: Move forward 35 steps and turn right by 40 degrees. To see the shape that this function creates, try calling it in the command center with one turtle with the pen down. A turtle will create a nine-gon heading in the right direction. SLIDER DESCRIPTIONS ------------------- EXPANDER -------- Numbered from 0 to 90 and increments by 1. Expands and contracts the square created by LEFT-SQUARE. Associated with PATTERN-5. DIRECTION --------- Numbered from 0 to 10 and increments by 0.1 or (1/10). Turns a turtle to the right by the number of degrees specified by the slider. Associated with PATTERN-3 and PATTERN-1. WHAT THE PATTERNS DO ---------------------------- PATTERN-1 ---------- In this pattern, every 10th turtle moves forward .5 steps and to the right by DIRECTION degrees. Each call to the pattern hatches a turtle who performs the RIGHT-SHAPE function, then the LEFT-SHAPE function and then dies. By increasing the DIRECTION, the turtles increase the degrees by which they turn to the right. This means that at each forward movement the turtle turns tighter around a center point. Thus, when DIRECTION is set to 0, the turtle simply moves forward. The more it is increased, say from 0 to 1 to 2 to 10, the more circular the turtles movement becomes. Although the pattern changes, it must be understood that the underlying shape that is being created is a circle. PATTERN-2 ---------- Every even numbered turtle moves forward 1 step and turns right by 1 degree. It then hatches a turtle that performs the HEXAGON function and then dies. Every odd numbered turtle moves forward 1 step and turns left by 1 degree. It then hatches a turtle that performs the OCTAGON function and then dies. It is interesting to note that when the nturtles slider is raised to a high number ,i.e., greater than or equal to 200, the pattern in the lower numbers becomes unrecognizable. However, it must be understood that although the new pattern may appear to be different, still, the underlying shapes that are being made are the hexagon and octagon. PATTERN-3 ---------- Every 5th turtle moves forward .5 steps and turns right by DIRECTION degrees. It then hatches a turtle which performs the PENTAGON function and then dies. PATTERN-3 and PATTERN-5 are probably the simplest patterns in this model in terms of explaining their behavior. Basically, PATTERN-3 creates pentagons, but because the turtles move forward .5 and move to the right DIRECTION number of degrees, this is what causes the pattern to drastically change. The illusion is that the hatched turtles are somehow creating different shapes but the truth of the matter is that they are making pentagons and always will be making pentagons. It is only the slight variations in outside influences that brings about a change in the pattern. PATTERN-4 ---------- Every 3rd turtle turns right by 1 degree and then hatches a turtle that performs the NINE-GON function and then dies. All the other turtles turn left by 1 degree and then hatch a turtle that performs the LEFT-SHAPE function and then dies. PATTERN-5 ---------- Every turtle hatches another turtle that performs the LEFT-SQUARE function and then dies. PATTERN-6 ---------- Every turtle moves forward DIRECTION steps and then hatches a turtle which performs the following functions in the following order: NINE-GON, OCTAGON, RIGHT-SHAPE, PENTAGON, HEXAGON, and LEFT-SHAPE. After performing these functions, each hatched turtle then dies. IMPORTANT NOTES ************************************************************ Notice that in each of these functions, the number of times the procedure is repeated multiplied by the number of degrees the turtle turns either to the right or to the left is equal to 360 degrees. Which means that each of the turtles is creating a polygon. I discovered that in the patterns where the turtle moves a number of steps forward and then turns right or left in some direction, this action significantly changes the pattern. For example, in pattern-1, the fact that each hatching turtle moves .5 steps forward means that the resulting shape from the RIGHT-CIRCLE OR LEFT-CIRCLE function will resemble a kidney bean rather than a circle, which is what the RIGHT-CIRCLE and LEFT-CIRCLE function are designed to produce. It is important to understand that these patterns are able to be created because they obey certain basic rules about geometry. For example, I mentioned above that all the functions create polygons. This is due to the fact that every polygon must have the interior sum of its angles equal to 360 degrees. However, certain slight alterations like those mentioned above, are enough to change the shape and create a new one. For example, if the DIRECTION slider started off at 0 in pattern-1, every hatching turtle would simple be moving forward by .5 steps as it was creating its pattern. However, if we increase the slider by increments of .1, we notice that its movements seem to be getting tighter and tighter until it remains fixed in one place and keeps revolving around a point. ************************************************************