Skip to content

Commit 8a90419

Browse files
committed
added requirements.txt
1 parent 388ff97 commit 8a90419

3 files changed

Lines changed: 61 additions & 0 deletions

File tree

.codenvy/project.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"runners":{"configs":{"system:/python/web/python27":{"variables":{},"ram":0,"options":{}}},"default":"system:/python/web/python27"},"type":"python","attributes":{},"description":"Turtle graphics in Python"}

main.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
from turtle import *
3+
from time import clock
4+
5+
class Vec3(tuple):
6+
7+
def __new__(cls, x, y, z):
8+
return tuple.__new__(cls, (x, y, z))
9+
def __add__(self, other):
10+
return Vec3(self[0]+other[0], self[1]+other[1], self[2]+other[2])
11+
def __rmul__(self, other):
12+
return Vec3(self[0]*other, self[1]*other, self[2]*other)
13+
14+
def triangle(laenge, stufe, f1, f2, f3): # f1, f2, f3 colors of the vertices
15+
if stufe == 0:
16+
color((1./3)*(f1+f2+f3))
17+
begin_fill()
18+
for i in range(3):
19+
fd(laenge)
20+
lt(120)
21+
end_fill()
22+
else:
23+
c12 = 0.5*(f1+f2)
24+
c13 = 0.5*(f1+f3)
25+
c23 = 0.5*(f2+f3)
26+
triangle(0.5*laenge, stufe - 1, f1, c12, c13)
27+
fd(laenge)
28+
lt(120)
29+
triangle(0.5*laenge, stufe - 1, f2, c23, c12)
30+
fd(laenge)
31+
lt(120)
32+
triangle(0.5*laenge, stufe - 1, f3, c13, c23)
33+
fd(laenge)
34+
lt(120)
35+
36+
def main():
37+
setup(720, 720)
38+
reset()
39+
setundobuffer(1)
40+
sierp_size = 600
41+
colormode(255)
42+
speed(0)
43+
ht()
44+
pu()
45+
bk(sierp_size*0.5)
46+
lt(90)
47+
bk(sierp_size*0.4)
48+
rt(90)
49+
tracer(1,0)
50+
ta = clock()
51+
triangle(sierp_size, 6,
52+
Vec3(255.0,0,0), Vec3(0,255.0,0), Vec3(0,0,255.0))
53+
tb = clock()
54+
return "%.2f sec." % (tb-ta)
55+
56+
if __name__ == '__main__':
57+
msg = main()
58+
print(msg)
59+
mainloop()

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Flask==0.8

0 commit comments

Comments
 (0)