-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsnowflake.py
More file actions
33 lines (29 loc) · 734 Bytes
/
snowflake.py
File metadata and controls
33 lines (29 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import turtle
twig_size = 100
flakes = 3
twig_amount = 3
def createArm(amount, iteration, twig_amount):
if (iteration < 1):
return
turtle.left(360 / amount)
turtle.fd(twig_size)
createTwig(twig_amount)
turtle.bk(twig_size * (twig_amount + 1))
createArm(amount, iteration - 1, twig_amount)
def createTwig(amount):
if (amount < 1):
return
turtle.fd(twig_size)
turtle.bk(twig_size)
turtle.left(45)
turtle.fd(twig_size)
turtle.bk(twig_size)
turtle.right(90)
turtle.fd(twig_size)
turtle.bk(twig_size)
turtle.left(45)
turtle.fd(twig_size)
createTwig(amount - 1)
turtle.pendown()
createArm(flakes, flakes, twig_amount)
turtle.Screen().exitonclick()