# Tag Archives: koch curve

## The Koch Curve as Snowflake with Python Turtle Graphics

It’s over midnight here.. Since the source code in one of my videos is not very readable, I decided to publish the Python source code of the video in this blog post.

```import turtle

def draw_curve():
window = turtle.Screen()
turt=turtle.Turtle()
turt.setpos(-300,-100)
turt.clear()
turt.speed('fastest')
turt.hideturtle()

vonKoch(turt,5,500)
turt.left(120)
vonKoch(turt,5,500)
turt.left(120)
vonKoch(turt,5,500)
turt.left(120)
vonKoch(turt,5,500)
window.exitonclick()

def vonKoch(turt,depth,length):
if depth == 0: turt.forward(length)
else:
vonKoch(turt,depth-1,length/3)
turt.right(60)
vonKoch(turt,depth-1,length/3)
turt.left(120)
vonKoch(turt,depth-1,length/3)
turt.right(60)
vonKoch(turt,depth-1,length/3)

draw_curve()
```

That’s it for now. Time to go to sleep.

## The Koch Curve

Back to the world of fractals…

One of the famous fractals is the Koch curve, described by Helge von Koch in the early 1900s.

The basic idea of this fractal is as follows:

1. Take an equliteral triangle, build another triangle in the middle of each side of the shape, the new triangle having a base length of 1/3 of the length of the side.