Reference no: EM132196712
Write a C++ program to read in a Tic-Tac-Toe board, make a move, then save the board back to the file.
Input:
The input will be given on the command line. The first argument is the name of the file containing the game board. The second argument is the letter of who to move as, X or O.
$ ./project game_board.dat X
If the letter provided is 'X' (case-INsensitive), play as the letter 'X'. Any other letter will result as playing as 'O'.
Game Board File:
The file holding the game board is made up of 3 lines, 4 chars each. The first 3 chars of a line representing the row of the TTT board. The last char is "\n".
The 3 chars for the rows of the TTT board may be 'X', 'O', or space.
Here is an example:
$ cat board.dat X O OX X $
Output:
The output of your project 4 should be:
1. The resulting game board after your move
2. Who won, tie game, else nothing.
Example:
$ cat board.dat X O O X $ ./project4 board.dat X X O OX X X Wins! $
Execution:
Your program, when launched with the above command-line parameters, should:
Obtain the game board file name and player to move as
Read in the game board
Make a move as the specified player
Save the resulting game board to the same file.
State a winner or tie, if applicable
Quit