summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--robots/cursesviewer.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/robots/cursesviewer.py b/robots/cursesviewer.py
index 4221117..257c425 100644
--- a/robots/cursesviewer.py
+++ b/robots/cursesviewer.py
@@ -21,14 +21,19 @@ class CursesViewer:
colours = cycle('red blue green yellow magenta cyan'.split())
self.player_colours = dict(zip(
- game.state.players,
+ sorted(game.state.players),
colours,
))
- self.player_colours[City.GHOST] = 'white'
def draw_board(self, state):
print(self.terminal.clear, end='')
+ players = []
+ for name, colour in sorted(self.player_colours.items()):
+ fn = getattr(self.terminal, 'on_' + colour)
+ players.append(fn(name))
+ print(' '.join(players))
+
width = len(state.board[0]) * 3
print(Box.TL + Box.H * width + Box.TR)
@@ -75,6 +80,7 @@ class CursesViewer:
for state in self.game:
next(limiter)
self.draw_board(state)
+# input()
winners = self.game.finished
if winners is True: