Suppose that two players are playing a tic-tac-toe game on an board. They’re following specific rules to play and win the game:
Implement a TicTacToe class, which will be used by two players to play the game and win fairly.
Keep in mind the following functionalities that need to be implemented:
TicTacToe, allowing the players to play on a board of size .player, places their mark on the cell (row, col). The move is guaranteed to be a valid move. At each move, this function returns the player ID if the current player wins and returns if no one wins.Constraints:
player should be either 1 or 2.
row, col
Every call to move() will be with a unique row, col combination.
The move() function will be called at most times.
Suppose that two players are playing a tic-tac-toe game on an board. They’re following specific rules to play and win the game:
Implement a TicTacToe class, which will be used by two players to play the game and win fairly.
Keep in mind the following functionalities that need to be implemented:
TicTacToe, allowing the players to play on a board of size .player, places their mark on the cell (row, col). The move is guaranteed to be a valid move. At each move, this function returns the player ID if the current player wins and returns if no one wins.Constraints:
player should be either 1 or 2.
row, col
Every call to move() will be with a unique row, col combination.
The move() function will be called at most times.