''' Koch Fractal Pylie.com ''' import turtle order = 2 def koch(laki, order, size): if order == 0: laki.forward(size) else: koch(laki, order-1, size/4.5) laki.left(60) koch(laki, order-1, size/4.5) laki.right(120) koch(laki, order-1, size/4.5) laki.left(60) koch(laki, order-1, size/4.5) laki = turtle.Turtle() laki.shape('turtle') laki.speed(order*3) laki.color('purple', 'deeppink') laki.penup() laki.goto(-45,175) laki.pendown() for i in range(1,9): koch(laki, order, 170) laki.right(45)
اجرا کن
پاک کن