Check whether game has ended correctly
This commit is contained in:
parent
7adfaa80aa
commit
c465a8406c
|
@ -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."
|
||||||
|
|
Loading…
Reference in New Issue