summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--robots/cursesviewer.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/robots/cursesviewer.py b/robots/cursesviewer.py
index 257c425..d369a80 100644
--- a/robots/cursesviewer.py
+++ b/robots/cursesviewer.py
@@ -26,16 +26,17 @@ class CursesViewer:
))
def draw_board(self, state):
- print(self.terminal.clear, end='')
+ stdout = []
+ stdout.append(self.terminal.clear)
players = []
for name, colour in sorted(self.player_colours.items()):
fn = getattr(self.terminal, 'on_' + colour)
players.append(fn(name))
- print(' '.join(players))
+ stdout.append(' '.join(players) + '\n')
width = len(state.board[0]) * 3
- print(Box.TL + Box.H * width + Box.TR)
+ stdout.append(Box.TL + Box.H * width + Box.TR + '\n')
for y, row in enumerate(state.board):
output = []
@@ -70,9 +71,10 @@ class CursesViewer:
value = func(value)
output.append(value)
- print(Box.V + ''.join(output) + Box.V)
+ stdout.append(Box.V + ''.join(output) + Box.V + '\n')
- print(Box.BL + Box.H * width + Box.BR)
+ stdout.append(Box.BL + Box.H * width + Box.BR + '\n')
+ print('\n'.join(stdout), end='')
def run(self):
limiter = rate_limit(10)