Question: Introduction Example Input: Tic-tac-toe is a game for two players, X and o, who take turns marking the spaces in a 3 x 3 grid.

Introduction Example Input: Tic-tac-toe is a game for two players, X and o, who take turns marking the spaces in a 3 x 3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical or diagonal row wins the game. 8 0-X-OOXXX XOX-Oxo-X X-O-XO-- OXOXXOXOX --X-X-X00 XXOXO-0-- The following example game is won by the first player, X: ax ax ax gos & Sa Program Output For each test case, your program should output one line in the following format: You have been hired by CoolGames, Inc. to create a tic-tac-toe checker program that they can use to determine whether X wins, O wins, or if a tie has resulted. Program Input The original input line followed by a single space, an equal sign, and another single space One of the following three phrases depending on the outcome of the game: X WINS O WINS TIE o The first line of the file xcred.txt will contain a positive integer T denoting the number of test cases that follow. Each test case will have the following input: Example Output: . A single line of characters denoting the current state of a Tic-Tac-Toe game The game state will be represented as follows: 0-x-ooxxx = X WINS xox-Oxo-X = X WINS X-0-xo--o = O WINS oxoxxoxox = TIE --x-x-xoo = X WINS XXOXO-0-- = O WINS xoxxoooxx = TIE = TIE 1 2 3 0 4 5 6 - O O 123456789 O-X-OOXXX 7 8 9 X Figure 1. Tic-Tac-Toe Mapping Figure 2. Tic-Tac-Toe Game Figure 3. Tic-Tac-Toe Encoding In Figure 1, it shows how the values in the tic-tac-toe board are mapped. In Figure 2, it shows an example tic-tac-toe game being played where "-" means no one has played in the area. In Figure 3, it shows how the tic-tac-toe game is encoded into a string of values based on the board mapping
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
