-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathfastmode.py
56 lines (45 loc) · 1.54 KB
/
fastmode.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
from game.egame import EGame
import threading
class Fastmode(threading.Thread):
def __init__(self, threadid, config, optimizers):
threading.Thread.__init__(self)
self.threadid = threadid
self.config = config
self.optimizers = optimizers
self.global_config = self.config.global_config
self.resolution = (self.global_config['window']['width'],
self.global_config['window']['height'])
self.parent_window = self
self.frame_dimension = (self.global_config['frame']['width'],
self.global_config['frame']['height'])
self.fg = FrameGeometry(self.global_config['frame']['width'],
self.global_config['frame']['height'])
self.msg2Statusbar = Msg2StatusBar()
def run(self):
print("starting thread", self.threadid)
game = EGame(self)
game.start()
while game.running:
game.update()
# result is the winner of the game
# 0 = blue breeder, 1 = yellow breeder
self.result = game.result
print(self.result)
return self.result
def frameGeometry(self):
return self.fg
def stop_timer(self):
pass
class FrameGeometry:
def __init__(self, width, height):
self.w = width
self.h = height
def width(self):
return self.w
def height(self):
return self.h
class Msg2StatusBar:
def __init__(self):
pass
def emit(self, string):
pass