-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcontroller.py
65 lines (61 loc) · 1.69 KB
/
controller.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
from api import *
import threading, os, sys
class myThread (threading.Thread):
def __init__(self, botId):
threading.Thread.__init__(self)
self.botId = botId
def run(self):
os.system("python3 code.py "+str(self.botId))
level = 0
while level == 0:
if sys.version_info[0] == 2:
level = int(raw_input("Please enter the level you're attempting(1-6): "))
else:
level = int(input("Please enter the level you're attempting(1-6): "))
if 1 <= level <= 6:
restart_mission(level)
break
else:
level = 0
if level == 1:
os.system("python3 code.py 0")
print("The final score is: " + str(get_score()))
elif level == 2:
os.system("python3 code.py 0")
print("The final score is: " + str(get_score()))
elif level == 3:
threads = []
for i in range(2):
thread = myThread(i)
threads.append(thread)
thread.start()
for t in threads:
t.join()
print("The final score is: "+str(get_score()))
elif level == 4:
threads = []
for i in range(get_numbots()):
thread = myThread(i)
threads.append(thread)
thread.start()
for t in threads:
t.join()
print("The final score is: "+str(get_score()))
elif level == 5:
threads = []
for i in range(2):
thread = myThread(i)
threads.append(thread)
thread.start()
for t in threads:
t.join()
print("The final score is: "+str(get_score()))
elif level == 6:
threads = []
for i in range(get_numbots()):
thread = myThread(i)
threads.append(thread)
thread.start()
for t in threads:
t.join()
print("The final score is: "+str(get_score()))