def test_board_is_winner_winningline_is_corect(self,size,initial_grid,winner): board1 = Board(size); board1.grid = initial_grid board1.is_winner(RECORD_THE_WINNER) self.assertEqual(board1.winner,winner)
def test_board_is_winner_true(self,size,initial_grid): board1 = Board(size); board1.grid = initial_grid self.assertTrue(board1.is_winner(RECORD_THE_WINNER))
print("Sorry - You must enter a numeric value!") return int(gameoption) board1 = Board() gameoption = game_setup() if gameoption == 1: player1 = Player("X") player2 = Player("O") elif gameoption == 2: player1 = Player("X") player2 = AIPlayer("O", 2, -10) else: player1 = Player("X") player2 = AIPlayer("O", 4, -2) game_complete = False counter = 0 board1.print() while not game_complete and not board1.is_winner(RECORD_THE_WINNER): player1.take_turn(board1) if (counter % 2) == 0 else player2.take_turn(board1) if (board1.is_game_over()): print("The game was a tie.") game_complete = True counter += 1 board1.print() if board1.winner != '': print(f"The winner was Player 1") if ( player1.symbol) == board1.winner else print(f"The winner was Player 1")