ABSTRACT

The Sierpinski gasket and the Koch snowflake can both be generated in LOGO using recursive turtle programs. But in CODO there is no recursion. How then can we generate fractals in CODO?

Consider the first few levels of the Sierpinski gasket depicted in Figure 6.1. We begin with a triangle. The next level contains three smaller triangles. (Ignore the central upside-down triangle.) Each of these smaller triangles is a scaled down version of the original triangle. If we denote the vertices of the original triangle by P1, P2, P3, then we can generate the three small triangles by scaling by 1=2 around each of the points P1, P2, P3-that is, by applying the three transformations Scale(P1, 1=2), Scale(P2, 1=2), and Scale(P3, 1=2) to DP1P2P3. Now the key observation is that to go from level 1 to level 2, we can apply these same three transformations to the triangles at level 1. Scaling by 1=2 at any corner of the original triangle maps the three triangles at level 1 to the three smaller triangles at the same corner of level 2. We can go from level 2 to level 3 in the same way, by applying the transformations Scale(P1, 1=2), Scale(P2, 1=2), and Scale(P3, 1=2) to the triangles in level 2. And so on and so on. Thus, starting with DP1P2P3 and iterating the transformations Scale(P1, 1=2), Scale(P2, 1=2), and Scale(P3, 1=2) n times generates the nth level of the Sierpinski gasket.