diff options
author | Peter Ward <peteraward@gmail.com> | 2012-11-19 18:57:35 +1100 |
---|---|---|
committer | Peter Ward <peteraward@gmail.com> | 2012-11-19 18:57:35 +1100 |
commit | 0d85f89a27fa075dcfd9933f4a506c8c95b191c6 (patch) | |
tree | aca4bd9d1ed4ad711df38270727fffc61f0e9212 | |
parent | 7aa825614c88a2bb73989d8d938f078a6c7391b8 (diff) |
enable user-defined bot colours
-rw-r--r-- | snakegame/engine.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/snakegame/engine.py b/snakegame/engine.py index 402dc67..ba6c24c 100644 --- a/snakegame/engine.py +++ b/snakegame/engine.py @@ -61,7 +61,7 @@ class Engine(object): x, y = self.get_random_position() self.board[y][x] = common.APPLE - def add_bot(self, bot, team=None): + def add_bot(self, bot, team=None, colour=None): """ A bot is a callable object, with this method signature: def bot_callable( @@ -76,7 +76,8 @@ class Engine(object): letter = self.letters.pop() name = bot.__name__ - colour = hash_colour(name) + if colour is None: + colour = hash_colour(name) position = self.replace_random(common.EMPTY, letter.upper()) if position is None: |