from Player import Player from Board import Board class TicTacToe: def __init__(self): self.players = [] self.players.append( Player("X", "Player 1") ) self.players.append( Player("O", "Player 2") ) def run(self): self.board = Board() player = 0 while len(self.board.empty_fields) != 0: self.board.make_move(self.players[player].token, self.players[player].choose_random_field(self.board.empty_fields)) if self.board.is_win(self.players[player].token): self.board.print() print(self.players[player].name + " has won.\n") break if (player == 0): player = 1 else: player = 0 else: self.board.print() print("It's a draw.\n")