diff options
author | Peter Ward <peteraward@gmail.com> | 2009-10-28 17:40:37 +1100 |
---|---|---|
committer | Peter Ward <peteraward@gmail.com> | 2009-10-28 17:40:37 +1100 |
commit | 6941f7192fe34add95bd444491f399408eaac014 (patch) | |
tree | 5a53522eb82dfd18fc695c9b8729e5fe6db49f76 /snake.py | |
parent | 03d66dd939fea56ce807d58d65475b45e15523d6 (diff) |
Added game id to allow stats.
Diffstat (limited to 'snake.py')
-rw-r--r-- | snake.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -2,8 +2,10 @@ from __future__ import division +import sys import time import string +import random from random import randint from collections import deque from copy import deepcopy @@ -18,6 +20,8 @@ class SnakeEngine(object): self.letters = list(string.lowercase) self.letters.reverse() + self.game_id = random.randint(0, sys.maxint) + self.bots = {} self.results = None if results: @@ -91,7 +95,8 @@ class SnakeEngine(object): pass else: apple_score = len(bot[2]) - self.results.write('%s,%s,%s\n' % (name, apple_score, time_score)) + self.results.write('%s,%s,%s,%s\n' % \ + (self.game_id, name, apple_score, time_score)) self.results.flush() def update_snakes(self, directions_id=id(directions)): |