# Sierpinski & Koch

Two of the most famous fractals are the Sierpinski Triangle and the Koch Snowflake.

A Sierpinski Triangle in Plain English

This is a Plain English description of how to draw a Sierpinski Triangle:

To draw a Sierpinski Triangle starting with a size:
If the size is less than 1/8 inch, exit.
Draw another Sierpinski Triangle starting with the size divided by 2.
Draw a line using the size for the length.
Refresh the screen.
Turn right 1/3 of the way around.
Add 1 to a count. If the count is 3, break.
Repeat.

If we call the above routine from this top-level routine…

To run:
Start up.
Clear the screen with the tan color. Use the dark brown pen.
Start 4 inches to the left and 3-1/2 inches down from the screen’s center.
Turn right 1/12 of the way around.
Draw a Sierpinski Triangle starting with 8 inches.
Wait for the escape key.
Shut down.

…this is what we get on the screen:

Triangles within triangles within triangles. Nifty.

A Koch Snowflake in Plain English

Now these are the Plain English routines we need to draw a Koch Snowflake:

To draw a Koch Snowflake given a size and a depth:
Loop.
Draw a Koch Curve with 3 inches and the depth.
Refresh the screen.
Turn left 1/3 of the way around.
Add 1 to a count. If the count is 3, break.
Repeat.

To draw a Koch Curve given a size and a depth:
If the depth is 0, draw a line using the size for the length; exit.
Put the size divided by 3 into a new size.
Draw the Koch Curve given the new size and the depth minus 1.
Turn right 1/6 of the way.
Draw a second Koch Curve given the new size and the depth minus 1.
Turn left 2/6 of the way.
Draw a third Koch Curve given the new size and the depth minus 1.
Turn right 1/6 of the way.
Draw a fourth Koch Curve given the new size and the depth minus 1.

If we position ourselves properly on the screen and call the first routine above four times, increasing the depth by one each time, we get this on the screen:

1. At the top-left, we see that our snowflake, at depth zero, is just a simple triangle.

2. At the top-right, one level deeper, we see that each of the sides of the triangle has been divided into three parts, the middle part being replaced with a “peak”.

3. Continuing clockwise around the screen, at the bottom-right, we see that at the next level down, each of the sides of preceding figure is again divided into thirds, with the middle third being replaced by a peak of the appropriate size.

4. Finally, at the bottom-left, yet another level down, we see the finished snowflake. I say “finished” even though we could go deeper and deeper if our screen had the resolution to display it clearly.

A Koch Triangle in Plain English

Something curious happens if, when we’re drawing a Koch Snowflake, we turn right instead of left at each of the original vertices (the revised routine is shown below, with the modified word in all uppercase letters).

To draw a Koch Snowflake given a size and a depth:
Loop.
Draw a Koch Curve with 3 inches and the depth.
Refresh the screen.
Turn RIGHT 1/3 of the way around.
Add 1 to a count. If the count is 3, break.
Repeat.

The result is an “inside-out” snowflake, or what I call, a Koch Triangle:

Comparing the top-right figure with the finished bottom-left figure, perhaps a better name would be “The Mitsubishi Logo on Steroids.”

Another curious thing happens when we tile some Koch Snowflakes; we get the flakes and the triangle together. Here’s the main routine…

To run:
Start up.
Clear the screen with the tan color. Use the dark brown pen.
Turn right 7/12 of the way around. Move up 1/2 inch.
Loop.
Draw a Koch Snowflake given 4 inches and 3.
Turn right 1/3 of the way around.
Add 1 to a count. If the count is 3, break.
Repeat.
Wait for the escape key.
Shut down.

…and here’s the result:

We can get other interesting results if we base our snowflakes on, say, a hexagon rather than a triangle. Here’s a main routine that does that (by turning 1/6 instead of 1/3 of the way around), with some tiling as well:

To run:
Start up.
Clear the screen with the tan color. Use the dark brown pen.
Turn right 7/12 of the way around.
Loop.
Draw a Koch Snowflake given 3 inches and 3.
Turn right 1/6 of the way around.
Add 1 to a count. If the count is 6, break.
Repeat.
Wait for the escape key.
Shut down.

And here’s what the screen looks like when we run that:

Well, I could go on all day with this kind of thing, but I’m sure you get the idea. More fun and interesting programs written entirely in Plain English.