-
Notifications
You must be signed in to change notification settings - Fork 0
/
11fractals.py
61 lines (53 loc) · 1.49 KB
/
11fractals.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# coding=utf-8
import turtle
def draw_triangle(some_turtle, vertice=120, edge=160, color_filled='green'):
some_turtle.color('black', color_filled)
if vertice == 120:
some_turtle.begin_fill()
some_turtle.forward(edge)
some_turtle.left(120)
some_turtle.forward(edge)
some_turtle.left(120)
some_turtle.forward(edge)
some_turtle.end_fill()
else:
some_turtle.begin_fill()
some_turtle.left(60)
some_turtle.forward(edge)
some_turtle.left(120)
some_turtle.forward(edge)
some_turtle.left(120)
some_turtle.forward(edge)
some_turtle.end_fill()
# some_turtle.home()
# def draw_fractals(some_turtle):
#
brad = turtle.Turtle()
win = turtle.Screen()
draw_triangle(brad, 120, 240,'blue')
brad.left(120)
# for i in range(3):
# brad.forward(30)
# draw_triangle(brad, 60, 30, 'white')
# brad.left(60)
# brad.forward(30)
# draw_triangle(brad, 60, 60, 'white')
# brad.left(60)
# brad.forward(30)
# draw_triangle(brad, 60, 30, 'white')
# brad.left(60)
# brad.forward(30)
# draw_triangle(brad, 60, 120, 'white')
# brad.left(60)
# brad.forward(30)
# draw_triangle(brad, 60, 30, 'white')
# brad.left(60)
# brad.forward(30)
# draw_triangle(brad, 60, 60, 'white')
# brad.left(60)
# brad.forward(30)
# draw_triangle(brad, 60, 30, 'white')
# brad.left(60)
# brad.forward(30)
# brad.left(120)
win.exitonclick()