From f74433c7c765c6b6356f6ec20289c87b59b0bfc6 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 30 Sep 2017 14:04:20 -0700 Subject: [PATCH] Output the board as a 1D list of characters --- tictactoe.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tictactoe.py b/tictactoe.py index db29436..fd08405 100644 --- a/tictactoe.py +++ b/tictactoe.py @@ -170,11 +170,13 @@ def hello(): return ("It isn't O's turn.\n\n{}".format(board), 400, {'Content-type': 'text/plain'}) next_board = board.move() - out = str(next_board) if bool(os.environ.get('TTT_DEBUG', False)): import pprint + out = str(next_board) out += '\n\n---------- DEBUG ----------' out += '\n\nInput:\n{}'.format(board) out += '\n\nScore: {}'.format(board.score) out += '\n\nChildren:\n{}'.format(pprint.pformat(board.children)) + else: + out = next_board.board return (out, 200, {'Content-type': 'text/plain'})