# Koch Snowflake

In the article on Koch Curves we derived the famous koch-curve, by starting with a line, then a bumpy-line, then a self-similar recursive bumpy-line. The final result looked like this:

to koch_curve :length :limit ifelse :limit = 0 [ fw :length ] [ koch_curve :length/3 :limit - 1 lt 60 koch_curve :length/3 :limit - 1 rt 120 koch_curve :length/3 :limit -1 lt 60 koch_curve :length/3 :limit - 1 ] end koch_curve 240 5

Now we can put three of them together to make Koch's snowflake.

to koch_curve :length :limit ifelse :limit = 0 [ fw :length ] [ koch_curve :length/3 :limit - 1 lt 60 koch_curve :length/3 :limit - 1 rt 120 koch_curve :length/3 :limit -1 lt 60 koch_curve :length/3 :limit - 1 ] end to koch_snowflake :length :limit repeat 3 [ koch_curve :length :limit rt 120 ] end koch_snowflake 240 5

# Layered Koch Snowflake

Layering several of them on top of each other looks pretty cool.

to koch_curve :length :limit ifelse :limit = 0 [ fw :length ] [ koch_curve :length/3 :limit - 1 lt 60 koch_curve :length/3 :limit - 1 rt 120 koch_curve :length/3 :limit -1 lt 60 koch_curve :length/3 :limit - 1 ] end to koch_snowflake :length :limit repeat 3 [ koch_curve :length :limit rt 120 ] end koch_snowflake 240 1 koch_snowflake 240 2 koch_snowflake 240 3 koch_snowflake 240 4 koch_snowflake 240 5

## Reverse Koch Snowflake

If you're thinking what I'm thinking, then what you are thinking is "If you're thinking what I'm thinking, then what you are thinking is 'Why turn right? Why not turn left?'" Which is very clever of you. If we turn our 3 Koch curves around (by turning those right turns to left turns), they will face inward, not outward, and we'll have a *reverse* Koch Snowflake.

to koch_curve :length :limit ifelse :limit = 0 [ fw :length ] [ koch_curve :length/3 :limit - 1 lt 60 koch_curve :length/3 :limit - 1 rt 120 koch_curve :length/3 :limit -1 lt 60 koch_curve :length/3 :limit - 1 ] end to reverse_koch_snowflake :length :limit repeat 3 [ koch_curve :length :limit lt 120 ] end reverse_koch_snowflake 240 5

There we have an inside-outed Koch Snowflake.

## Layered Reverse Koch Curve

We can layer that as well.

to koch_curve :length :limit ifelse :limit = 0 [ fw :length ] [ koch_curve :length/3 :limit - 1 lt 60 koch_curve :length/3 :limit - 1 rt 120 koch_curve :length/3 :limit -1 lt 60 koch_curve :length/3 :limit - 1 ] end to reverse_koch_snowflake :length :limit repeat 3 [ koch_curve :length :limit lt 120 ] end reverse_koch_snowflake 240 1 reverse_koch_snowflake 240 2 reverse_koch_snowflake 240 3 reverse_koch_snowflake 240 4 reverse_koch_snowflake 240 5

## Extra Long Reverse Koch Snowflake

Oh, one more trick.

What happens if we make an extra long reverse Koch Snowflake? Instead of putting 3 reverse snowflakes together, let's put 6 of them together. We'll need a smaller angle: instead of 120 degrees between one, we'll only need 60 degrees.

(And since it's going to be a larger structure, I'll make the sides a bit smaller, 120 instead of 240)

to koch_curve :length :limit ifelse :limit = 0 [ fw :length ] [ koch_curve :length/3 :limit - 1 lt 60 koch_curve :length/3 :limit - 1 rt 120 koch_curve :length/3 :limit -1 lt 60 koch_curve :length/3 :limit - 1 ] end to reverse_koch_snowflake :length :limit repeat 6 [ koch_curve :length :limit lt 60 ] end reverse_koch_snowflake 120 5

Ah, a double length reverse Koch Snowflake is just a Koch Snowflake.

Why? Because the spaces between Koch Snowflakes are themselves Koch Snowflakes.

## These Things Pack Together With No Room To Spare!

to koch_curve :length :limit ifelse :limit = 0 [ fw :length ] [ koch_curve :length/3 :limit - 1 lt 60 koch_curve :length/3 :limit - 1 rt 120 koch_curve :length/3 :limit -1 lt 60 koch_curve :length/3 :limit - 1 ] end to koch_snowflake :length :limit repeat 3 [ koch_curve :length :limit rt 120 ] end repeat 3 [ koch_snowflake 120 4 pu fd 80 lt 60 fd 80 rt 60 pd ] setxy 5 290 repeat 4 [ koch_snowflake 120 4 pu fd 80 lt 60 fd 80 rt 60 pd ] setxy 5 430 repeat 4 [ koch_snowflake 120 4 pu fd 80 lt 60 fd 80 rt 60 pd ]