From 487aa30ced047fb2ca8e4e5499836088b3ea5a67 Mon Sep 17 00:00:00 2001 From: Chris Proctor Date: Fri, 29 Apr 2022 14:47:25 -0400 Subject: [PATCH] Update tt_view to support a draw at the end of the game --- ttt_view.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ttt_view.py b/ttt_view.py index ccd7b83..ffdd71b 100644 --- a/ttt_view.py +++ b/ttt_view.py @@ -57,6 +57,12 @@ class TTTView: elif game.check_winner('X'): winner = game.players['X'] else: - raise Exception("Tried to conclude a game which wasn't over!") + winner = None print(self.goodbye) - print(f"Congratulations to {winner.name}.") + if winner: + print(f"Congratulations to {winner.name}.") + else: + print("Nobody won this game.") + + +