summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--snake.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/snake.py b/snake.py
index 95ddd16..0429040 100644
--- a/snake.py
+++ b/snake.py
@@ -38,7 +38,7 @@ class SnakeEngine(object):
return x, y
def new_game(self, rows, columns, n_apples):
- self.start_time = time.time()
+ self.game_ticks = 0
self.game_id = random.randint(0, sys.maxint)
self.letters = list(string.lowercase)
@@ -77,7 +77,7 @@ class SnakeEngine(object):
def remove_bot(self, letter):
letter = letter.lower()
- time_score = time.time() - self.start_time
+ time_score = self.game_ticks
for row in self.board:
for x, cell in enumerate(row):
@@ -104,6 +104,8 @@ class SnakeEngine(object):
assert id(directions) == directions_id, \
"The common.directions dictionary has been modified since startup..."
+ self.game_ticks += 1
+
for letter, (bot, colour, path) in self.bots.items():
board = deepcopy(self.board)
try: