-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall-SuiTurtle-modle.txt
228 lines (212 loc) · 5.22 KB
/
all-SuiTurtle-modle.txt
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
import turtle
#移动
#移动(50)
def moveon50():
turtle.forward(50)
def moveback50():
turtle.right(180)
turtle.forward(50)
def moveleft50():
turtle.right(270)
turtle.forward(50)
def moveleft50():
turtle.right(270)
turtle.forward(50)
#移动(100)
def moveon100():
turtle.forward(100)
def moveback100():
turtle.right(180)
turtle.forward(100)
def moveleft100():
turtle.right(270)
turtle.forward(100)
def moveleft100():
turtle.right(270)
turtle.forward(100)
#转向(矩形)
def turnleft():
turtle.left(90)
def turnright():
turtle.right(90)
#一个整的方形
def whole_spuare_50():
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
#三个合并的方形
def big_square_50_100_200():
big_square_x = 0
while big_square_x <= 2:
turtle.forward(50)
turtle.right(90)
big_square_x += 1
while big_square_x > 2 and big_square_x <= 6:
turtle.forward(100)
turtle.right(90)
big_square_x += 1
while big_square_x > 6 and big_square_x <= 9:
turtle.forward(200)
turtle.right(90)
big_square_x += 1
turtle.forward(200)
#转向(正三角形)
def tir_left():
turtle.left(60)
def tri_right():
turtle.right(60)
#整个三角形
def whole_tir_50():
turtle.right(120)
turtle.forward(50)
turtle.right(120)
turtle.forward(50)
turtle.right(120)
turtle.forward(50)
#三个三角形合并
def big_tri_50_100_200():
big_tri_x = 0
while big_tri_x <= 2:
turtle.right(120)
turtle.forward(50)
big_tri_x += 1
while big_tri_x > 2 and big_tri_x <= 5:
turtle.right(120)
turtle.forward(100)
big_tri_x += 1
while big_tri_x > 5 and big_tri_x <= 8:
turtle.right(120)
turtle.forward(200)
big_tri_x += 1
#转向(正五边形)
def pen_left():
turtle.left(72)
def pen_right():
turtle.right(72)
#整个五边形
def whole_pen_50():
penx = 0
while penx < 5:
turtle.forward(50)
pen_left()
penx += 1
#三个五边形合并
def big_pen_50_100_200():
big_pen_x = 0
while big_pen_x <= 5:
turtle.right(72)
turtle.forward(50)
big_pen_x += 1
while big_pen_x > 5 and big_pen_x <= 10:
turtle.right(72)
turtle.forward(100)
big_pen_x += 1
while big_pen_x > 10 and big_pen_x <= 15:
turtle.right(72)
turtle.forward(200)
big_pen_x += 1
#六边形转向
def hex_left():
turtle.left(60)
def hex_right():
turtle.right(60)
#整个六边形
def whole_hex_50():
hexx = 0
while hexx < 5:
turtle.forward(50)
hex_left()
hexx += 1
#三个六边形合并
def big_hex_50_100_200():
big_hex_x = 0
while big_hex_x <= 6:
turtle.right(60)
turtle.forward(50)
big_hex_x += 1
while big_hex_x > 6 and big_hex_x <= 12:
turtle.right(60)
turtle.forward(100)
big_hex_x += 1
while big_hex_x > 12 and big_hex_x <= 18:
turtle.right(60)
turtle.forward(200)
big_hex_x += 1
def p_4_square():
colours=["red","blue","purple","brown"]
x = 0
while x < len(colours):
turtle.pencolor(colours[x])
moveon50()
turnright()
moveon50()
moveright100()
moveright100()
x += 1
def p_6_big_tri():
x = 0
colours = ["red","blue","green","brown","black","purple"]
while x < 6:
turtle.pencolor(colours[x])
turtle.left(60)
big_tri_50_100_200()
x += 1
def p_max_square():
for i in range(360):
turtle.setheading(i)
for i in range(4):
turtle.forward(100)
turtle.left(90)
def p_halfmax_square():
for i in range(90):
turtle.right(1)
for i in range(4):
turtle.forward(100)
turtle.left(90)
#最终函数开始
def p_tri_squ_pen_hex():
color=["red","blue","purple","brown","black","yellow","green"]
for i in range(4):
for i in range(5):
turtle.pencolor(color[i])
turtle.forward(50)
hex_left()
turtle.right(60)
turtle.penup()
hex_left()
turtle.forward(50)
turtle.left(60)
moveon100()
moveon100()
moveon50()
turtle.right(90)
moveon50()
turtle.right(60)
turtle.pendown()
for x in range(4):
for j in range(3):
turtle.pencolor(color[j])
big_tri_50_100_200()
turtle.right(60)
turtle.left(60)
moveback100()
moveon100()
turnright()
for k in range(3):
turtle.pencolor(color[k])
whole_hex_50()
turtle.right(60)
moveon50()
moveon100()
whole_hex_50()
moveon50()
turtle.pencolor("green")
turtle.right(30)
p_max_square()
moveback100()
moveon100()
turtle.right(60)