-
Notifications
You must be signed in to change notification settings - Fork 0
/
house.py
142 lines (140 loc) · 4.55 KB
/
house.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
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
from turtle import *
from math import *
speed(0)
pensize(3)
up();goto(-400,-200);down()
fd(30);up();fd(20);down()
fd(50);up();fd(20);down()
fd(750);up();fd(10);down()
fd(20);up();fd(10);down()
fd(20);up();goto(-200,-200);down()
fillcolor('#EDEDED');begin_fill()
left(90);fd(90);x1,y1=pos()
left(-90);fd(610)#房子长度
x2,y2=pos()
left(-90);fd(90);end_fill()
up();goto(0,-200)#第一级台阶左下角坐标
down()
fillcolor('#CDB38B');begin_fill()
setheading(90);fd(30);left(-90);fd(270)
left(-90);fd(30);end_fill()
up();goto(5,-170)#第二级台阶左下角坐标
down()
begin_fill();setheading(90);fd(30)
left(-90);fd(260);left(-90);fd(30);end_fill()
up();goto(10,-140)#第三级台阶左下角的坐标
down()
begin_fill();setheading(90);fd(30);left(-90);fd(250)
left(-90);fd(30);end_fill()
up()
goto(10,-110)#坐标
down()
fillcolor('#F7F7F7');begin_fill();setheading(90)
fd(180);left(-90);fd(250);left(-90);fd(180);end_fill()
up();goto(10,70);down()
fillcolor('#EEDFCC');begin_fill();setheading(90)
fd(10);left(-90);fd(250);left(-90);fd(10);end_fill()
up();goto(x2,y2);down();fillcolor('#F7F7F7');begin_fill()
setheading(90);fd(190);x3,y3=pos();left(30)
fd(150);left(120);fd(150);setheading(-90);fd(190);end_fill()
up();goto(x3,y3);down()
fillcolor('#B3B3B3');begin_fill();setheading(0)
fd(10);left(120);fd(170);left(120);fd(170)
setheading(0);fd(10);left(60);fd(150);left(-120);fd(150)
end_fill()
up();goto(x1,y1);down()
fillcolor('#F7F7F7');begin_fill()
setheading(90);fd(190);left(-30);fd(210);left(-120);fd(210);left(-30)
fd(190)
end_fill()
up();goto(x1,y1+190);down()
fillcolor('#B3B3B3');begin_fill()
setheading(180);fd(10);left(-120);fd(230);left(-120);fd(230)
x4,y4=pos()
left(-120);fd(10);left(-60);fd(210);left(120);fd(210)
end_fill()
up();goto(x4,y4);down()
fillcolor('#EE5C42');begin_fill()
setheading(120);fd(130)
x5,y5=pos()
setheading(0);fd(360);left(-120);fd(130);setheading(180);fd(230)
end_fill()
up();goto(x5+300,y5);down()
begin_fill()
setheading(90);fd(50);left(-90);fd(30);left(-90);fd(50)
end_fill()
up();goto(110,-110);down()
fillcolor('#CDC5BF');begin_fill()
setheading(90);fd(120);left(-90);fd(60);left(-90);fd(120)
end_fill()
up();goto(130,-105);down()
setheading(90);fd(70)
up();fd(10);down();fd(20)
up();goto(150,-110);down();fd(40)
up();fd(30);down();fd(40)
up();goto(160,-50);down()
dot(5,'black')
up();goto(x2-20,y2+20);down();setheading(90)
fillcolor('#FF6A6A');begin_fill()
fd(100);circle(55,180);fd(100);left(90);fd(110)
end_fill()
up();goto(x2-30,y2+30);down();setheading(90)
fillcolor('#FFC125');begin_fill()
fd(90);circle(45,180);fd(90);left(90);fd(90)
end_fill()
up();goto(x2-55,y2+30);down();setheading(90);fd(130)
up();goto(x2-90,y2+30);down();setheading(90);fd(130)
up();goto(x2-30,y2+70);down();setheading(180);fd(90)
up();goto(x2-30,y2+100);down();setheading(180);fd(90)
up();goto(x1+180-20,y2+20);down();setheading(90)
fillcolor('#FF6A6A');begin_fill()
fd(100);circle(55,180);fd(100);left(90);fd(110)
end_fill()
up();goto(x1+180-30,y2+30);down();setheading(90)
fillcolor('#FFC125');begin_fill()
fd(90);circle(45,180);fd(90);left(90);fd(90)
end_fill()
up();goto(x1+180-55,y2+30);down();setheading(90);fd(130)
up();goto(x1+180-90,y2+30);down();setheading(90);fd(130)
up();goto(x1+180-30,y2+70);down();setheading(180);fd(90)
up();goto(x1+180-30,y2+100);down();setheading(180);fd(90)
up();goto(x2-75,y2+260);down();begin_fill();circle(30);end_fill()
up();goto(x2-75,y2+200);down();setheading(90);fd(60)
up();goto(x2-105,y2+230);down();setheading(0);fd(60)
up();goto(x1+180-75,y2+200);down();begin_fill();circle(40);end_fill()
up();goto(x1+180-75,y2+200);down();setheading(90);fd(80)
up();goto(x1+180-115,y2+240);down();setheading(0);fd(80)
up();goto(-300,300);down();pencolor('#5CACEE');fd(40);up();fd(10);down();fd(80)
up();goto(-300,320);down();fd(40);left(90);circle(20,180);setheading(0)
up();goto(-240,320);down();fd(80);left(90);circle(40,180);setheading(0)
up();goto(100,340);down();fd(50);up();fd(10);down();fd(30);up();fd(20);down()
fd(70)
up();goto(100,360);down();fd(40);left(90);circle(20,180);setheading(0)
up();goto(160,360);down();fd(80);left(90);circle(40,180);setheading(0)
up();goto(250,360);down();fd(40);left(90);circle(20,180);setheading(0)
tracer(False)
pencolor('#FF3030')
def koch(n,k):
if n==0:
forward(k)
else:
for angle in (60,-120,60,0):
koch(n-1,k/3)
left(angle)
delay(0)
i=0
while i<=7:
x=400+50*cos(i);y=350+50*sin(i)#圆的位置可以改变
up()
goto(x,y)
down()
koch(3,10)
right(120)
koch(3,10)
right(120)
koch(3,10)
i+=0.1
up()
goto(400,350)#太阳中心的坐标
down()
dot(100,'yellow')