diff options
author | Peter Ward <peteraward@gmail.com> | 2014-04-07 17:44:25 +1000 |
---|---|---|
committer | Peter Ward <peteraward@gmail.com> | 2014-04-07 17:44:25 +1000 |
commit | 0b49012756c4e68fd0fa7d44907483b0b0932e88 (patch) | |
tree | 3e4e331aae566e86064427061685ca7a1f8ca19b | |
parent | c04237f6127f848a01f1810e9e26eec1f20f2e31 (diff) |
render factories
-rw-r--r-- | robots/cursesviewer.py | 11 | ||||
-rw-r--r-- | simple.py | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/robots/cursesviewer.py b/robots/cursesviewer.py index 4d94491..bd26ef2 100644 --- a/robots/cursesviewer.py +++ b/robots/cursesviewer.py @@ -2,6 +2,7 @@ from itertools import cycle from blessings import Terminal +from robots.constants import City from robots.utils import rate_limit class Box: @@ -45,8 +46,16 @@ class CursesViewer: if foreground == background: foreground = 'white' + if cell['city'] == City.FACTORY: + value = '[%s]' % energy + else: + value = '<%s>' % energy + func = getattr(self.terminal, foreground) - value = func('<%d>') % energy + value = func(value) + + elif cell['city'] == City.FACTORY: + value = '[ ]' if background: func = getattr(self.terminal, 'on_' + background) @@ -119,6 +119,10 @@ if __name__ == '__main__': map_[5][15] = '3' map_[5][25] = '2' + for y in (2, 8): + for x in (5, 15, 25): + map_[y][x] = '+' + game = robots.Game(map_) game.add_bot(bot, 'Alice') game.add_bot(bot, 'Bob') |