Check whether game has ended correctly
This commit is contained in:
@@ -36,7 +36,10 @@ class TTTGame:
|
|||||||
|
|
||||||
def is_over(self):
|
def is_over(self):
|
||||||
"Checks whether the game is over."
|
"Checks whether the game is over."
|
||||||
return self.check_winner('X') or self.check_winner('O')
|
for space in self.board:
|
||||||
|
if space == None:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def check_winner(self, symbol):
|
def check_winner(self, symbol):
|
||||||
"Checks whether the player with `symbol` has won the game."
|
"Checks whether the player with `symbol` has won the game."
|
||||||
|
Reference in New Issue
Block a user