diff --git a/main.py b/main.py index a5c41d8..5b27ec5 100644 --- a/main.py +++ b/main.py @@ -13,9 +13,9 @@ class TicTacToe: def __init__(self): self.player1 = Player("X", "Player 1") self.player2 = Player("O", "Player 2") - self.board = Board() def run(self): + self.board = Board() while True: self.board.make_move(self.player1.token, self.player1.choose_random_field(self.board.empty_fields)) self.board.print() @@ -54,6 +54,9 @@ class Board: (self.state[6] == token and self.state[7] == token and self.state[8] == token)): print(name + " has won.") return True + if len(self.empty_fields) == 0: + print("It's a draw.") + return True return False def get_state():