diff options
author | Peter Ward <peteraward@gmail.com> | 2009-09-29 18:46:23 +1000 |
---|---|---|
committer | Peter Ward <peteraward@gmail.com> | 2009-09-29 18:46:23 +1000 |
commit | 5ecd377f1bf309d203ba1a2b9a8b09efed6c5bf3 (patch) | |
tree | aba58687b033b16daefa37c76e9bd0de30287d74 /snake.py | |
parent | bc47a4c3efe6006b42f1a4925a0994dc3e5093d1 (diff) |
More bug fixes.
Diffstat (limited to 'snake.py')
-rwxr-xr-x | snake.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -88,7 +88,7 @@ class SnakeEngine(object): self.apple = load_image(Sprites.APPLE) self.eyes = load_image(Sprites.EYES) - def add_bot(self, bot): + def add_bot(self, bot, colour=None): """ A bot is a callable object, with this method signature: def bot_callable( @@ -103,7 +103,8 @@ class SnakeEngine(object): if position is None: raise KeyError, "Could not insert snake into the board." - colour = (randint(0, 255), randint(0, 255), randint(0, 255)) + if colour is None: + colour = (randint(0, 255), randint(0, 255), randint(0, 255)) self.bots[letter] = [bot, colour, deque([position])] return letter |