Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import turtle
- def koch_curve(length, depth):
- if depth == 0:
- turtle.forward(length)
- else:
- for angle in [60, -120, 60, 0]:
- koch_curve(length / 3, depth - 1)
- turtle.left(angle)
- length = 400
- depth = 4
- turtle.penup()
- turtle.goto(-length / 2, 0)
- turtle.pendown()
- turtle.speed("fastest")
- turtle.hideturtle()
- for i in range(3):
- koch_curve(length, depth)
- turtle.right(120)
- turtle.done()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement