Update tt_view to support a draw at the end of the game
This commit is contained in:
parent
2c40608942
commit
487aa30ced
10
ttt_view.py
10
ttt_view.py
|
@ -57,6 +57,12 @@ class TTTView:
|
||||||
elif game.check_winner('X'):
|
elif game.check_winner('X'):
|
||||||
winner = game.players['X']
|
winner = game.players['X']
|
||||||
else:
|
else:
|
||||||
raise Exception("Tried to conclude a game which wasn't over!")
|
winner = None
|
||||||
print(self.goodbye)
|
print(self.goodbye)
|
||||||
print(f"Congratulations to {winner.name}.")
|
if winner:
|
||||||
|
print(f"Congratulations to {winner.name}.")
|
||||||
|
else:
|
||||||
|
print("Nobody won this game.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue