Write a program to read in a tic-tac-toe board

Assignment Help Computer Engineering
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

Reference no: EM132196712

Questions Cloud

Effective and lead to sustainable competitive advantage : Under what conditions would a different strategy across national borders be effective and lead to a sustainable competitive advantage?
Create an array of doubles and pass it to sort : Write C program with sort1 function: void sort(const double a[], unsigned els);
Focus your expansion strategy : Identify five or six industry key success factors of this market niche that may help you to focus your expansion strategy.
Write down model for competitive balance : The handbook chapter on competitive balance discusses a two team model for competitive balance in a sports league. Set up the two team, fixed talent model.
Write a program to read in a tic-tac-toe board : Write a C++ program to read in a Tic-Tac-Toe board, make a move, then save the board back to the file.
Literature on the integrated customer experience : Review the current literature on the Integrated Customer Experience and write a literature review which could be suitable for publication in an academic
What were positives and negatives related to the color : What were positives and negatives related to the color of their skin that was still an issue in most of their experiences.
Write a c program to solve a single quadratic equation : Reading of coefficients a, b, c shall be done by calling a function named readCoeffs(), once for each coefficient.
Purpose for conducting employee orientation : Identify the reasons and purpose for conducting employee orientation.

Reviews

Write a Review

Computer Engineering Questions & Answers

  What can be done to overcome this lack of portability

What can be done to overcome this lack of portability? A subtype can be used as a subtype mark for declaring another subtype.

  Create a set of three priority interrupts

Create a set of three priority interrupts and show how they are executed between times 0 and 80 ns. Only one program or interrupt can run at a time.

  Prepare a program to sorts the array into decreasing order

Write a program that inputs the 20 incomes into an array and then sorts the array into decreasing order - Prepare a program to sorts the array into decreasing order.

  Difference between fault tolerance and disaster recovery

How does the network administrator decide that backup method to implement?

  How would the supply chain for your online business look

How would the supply chain for your online business look like, supposing that you would have to choose between UPS Logistics

  Which of the subsequent statements is correct with regard

Which of the subsequent statements is correct with regard to distributed systems ?

  Calculate the total number of addresses available in this

Calculate the total number of addresses available in this block including all the special addresses. Show your calculation

  Windows notepad is a simple text editor illustrate the

question 1 windows notepad is a simple text editor. what is the difference between a text editor and a word

  Show circuit diagram with the appropriate number of gates

It is required that a NOR gate drive 30 other NOR gates. The fan-out of the IC logic family is 10, and no buffer gates are available.

  Part-11 how can you perform a oating point comparison you

part-11. how can you perform a ?oating point comparison? you should include two examples one in c-shell and one in

  Explain the use of the operators on integer operands

Define the relationship between a string conversion specifier '%s' and a character conversion specifier '%c' giving code to support your answer.

  Role of antennas in transmitting radio waves

Explain the role of antennas in transmitting the radio waves. What kinds of antenna are typically used in the wireless LAN?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd