Adding detection for game end

This commit is contained in:
Alex Yatskov 2014-05-19 11:15:33 +09:00
parent efe8f98177
commit e2d5f2580b

View File

@ -175,10 +175,12 @@ class Game:
self.tetrad = Tetrad.random() self.tetrad = Tetrad.random()
self.tetrad_next = Tetrad.random() self.tetrad_next = Tetrad.random()
self.counter = 0 self.counter = 0
self.active = True
def end_game(self): def end_game(self):
self.reset_board() self.reset_board()
self.active = False
def reset_board(self): def reset_board(self):
@ -195,9 +197,12 @@ class Game:
def advance(self, elapsed): def advance(self, elapsed):
if not self.active:
return
self.counter += elapsed self.counter += elapsed
if self.counter > self.interval: if self.counter > self.interval:
self.input_down() self.lower_tetrad()
def try_placement(self, tetrad): def try_placement(self, tetrad):