From 2c406089425e51ee73dabe6dd560e46652245505 Mon Sep 17 00:00:00 2001 From: Chris Proctor Date: Fri, 29 Apr 2022 14:45:28 -0400 Subject: [PATCH] slightly refactor game ending logic --- ttt_game.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ttt_game.py b/ttt_game.py index ca6993d..db65cf9 100644 --- a/ttt_game.py +++ b/ttt_game.py @@ -37,6 +37,10 @@ class TTTGame: def is_over(self): "Checks whether the game is over." + return self.board_is_full() or self.check_winner('X') or self.check_winner('O') + + def board_is_full(self): + "Checks whether all the spaces in the board are occupied." for space in self.board: if space == None: return False