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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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