Your task is to develop a program that supports the Tic-tac-toe game.
This is a partial judge problem. Please review the provided code and refer to the sections labeled "TODO" in the function.h file for further details, and using C++17 to submit your solution.
The first line of the input contains an integer N, representing the number of test cases. (1 ≤ N ≤ 5 × 104)
Each of the following N lines represents a test case. Each line records a game session, detailing every move made by the players. The game may conclude early if one player wins. The game records are formatted as follows (- -
represents the end of each test case):
<player1_symbol> <Move> <player2_symbol> <Move> ... <player1or2_symbol> <Move> - -
We guarantee that players will not play out of turn or make illegal moves, such as placing pieces on already occupied spaces.
The player's symbol will be either "O" or "X". The move format for Tic-tac-toe is x/y
where "x" represents the row and "y" represents the column, indicating the placement of a piece on the board at position board[x][y]
.
Refer to the sample output provided.
If a game concludes without a winner after all moves in each testcase, output "Tie". Otherwise, tell the winner of the game. Additionally, display the status of the board at the end of the game. Please ensure to leave an empty line in the output at the end of each test case.