-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
57 lines (47 loc) · 1.02 KB
/
demo.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
from TschunkView import *
from CodeView import *
import time
t = TschunkView(TschunkMap1())
#c = CodeView(TschunkMap1())
direction = 0
def simple_main():
print 'thread started!'
direction = -1
while True:
time.sleep(1)
if not t.move((0,direction)):
direction *= -1
def move():
time.sleep(1)
t.move()
def drop():
time.sleep(1)
t.drop()
def rotateLeft():
time.sleep(1)
global direction
directions = [(0, -1), (1, 0), (0, 1), (-1, 0)]
direction = (direction + 1) % 4
t.setDirection(directions[direction])
def main():
print 'thread started!'
for i in range(0,4):
# round i:
move()
move()
rotateLeft()
move()
move()
drop()
rotateLeft()
rotateLeft()
move()
move()
rotateLeft()
move()
if __name__ == '__main__':
print 'starting thead ...'
thread = threading.Thread(target=main)
thread.setDaemon(True)
thread.start()
pyglet.app.run()