Koch Snowflake

On this page, you will use recursion to draw the Koch snowflake.
Koch snowflake animation levels 1 to 6

The ch in Koch is like ch in Bach, or the Spanish pronunciation of x in Mexico or Xavier, or the j in Alejandra, or like the Yiddish pronunciation of ch in chutzpah.

The Koch snowflake consists of three copies of the Koch curve, arranged along the sides of a triangle:
Koch snowflake with triangle inscribed

Unlike tree and triangle fractal, this one does not return the sprite to the same place after each recursive call. It replaces a straight line with a bent line.
one side of Koch snowflake

The base case is just a line:
Koch snowflake level 1: just a straight line segment

At each next level, the algorithm draws four copies of the previous level, each one third the length of the previous level, arranged this way. (The red shows a smaller version of the previous level.)
Koch snowflake level 2: segment broken with an equilateral triangle in the middle third.

The red color was added here to make the previous level more visible. Your version should be all one color for now. (You can experiment with color when you are finished.)
Koch snowflake level 3: each segment broken with an equilateral triangle in the middle third.
Koch snowflake level 4: each segment broken with an equilateral triangle in the middle third.
Koch snowflake level 5: : each segment broken with an equilateral triangle in the middle third.

  1. "U7L2-KochSnowflake"Start a New Project called U7L2-KochSnowflake
  2. Complete this recursive procedure to draw one side of the Koch snowflake by filling in the blanks and adding additional blocks as needed.
    Koch curve level:(level#) size:(size#){if( ){move (size) steps} else{Koch curve level:() size:(); turn counterclockwise(60) degrees; ......}}
  3. When you get one side of the snowflake working, combine three of them to make the entire snowflake.
  4. Talk with Your Partner Why does the size in each recursive call have to be one third the size of the previous level? There are four copies; why not one fourth the size?
  1. These pictures are closely related to the Koch curve. See if you can generate pictures like these by changing the turning angles.
    Koch curve-like drawing 1 Koch curve-like drawing 2