Commits

Peter Ward  committed cfea483

Consistent ordering of players, colour key at top.

  • Participants
  • Parent commits f5fa68a

Comments (0)

Files changed (1)

File robots/cursesviewer.py

 
         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)
 
         for state in self.game:
             next(limiter)
             self.draw_board(state)
+#            input()
 
         winners = self.game.finished
         if winners is True: