Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following code has to be done in C++ language. Objectives: Apply Software Engineering design and implementation concept and object class: Tic-Tac-Toe program Write a

image text in transcribedimage text in transcribedimage text in transcribedThe following code has to be done in C++ language.

Objectives: Apply Software Engineering design and implementation concept and object class: Tic-Tac-Toe program Write a program that allows two players (X and O) to play the tic-tac-toe game on a 3 by 3 two-dimensional array board. Some of the operations on a ticTacToe object are printing the current board, getting a move, checking if a move is valid and determining the winner after each move. Add additional operations as needed. You are giving the Tic Tac Toe.h header file with the ticTacToe class as follows: Tic Tac Toe.h header file #include using namespace std; enum status {WIN, DRAW, CONTINUE }; class ticTac Toe public: void play(); //Function to start the play. void display Board() const; //Function to print the board. bool isValidMove(int x, int y) const; //Function to determine if a move is valid. bool getxoMove(char moveSymbol); //Function to get a move for a player status gameStatus(); //Function to determine the current status of the game. void restart(); //Function to restart the game. ticTacToe(); 1/Default constructor. //Postcondition: Initializes the board to an empty state. //Postcode private: char board[3][3]; int noOfMoves; 1 2 3 Sample Output Player O enter move (row col): 31 1 2 3 Player O enter move (row col): 22 1 x 1 Player O enter move (row col): 2 3 1 2 3 1 x 0 x 2 x 01 3 2 x 010 Player X enter move (row col): 11 30 1 2 3 301 x | 1 x 1 Player X enter move (row col): 13 1 2 3 1 x | x Player X enter move (row col): 33 3 1 1 X 2 0 X 10 3 301 1 Player O enter move (row col): 2 2 2 XL 0 0 -H 301 x x Player O enter move (row col): 12 1 2 3 1 x 1 This game is a draw! 1 2 3 1 x 0x -- - 2 XL 3 3 0 1 1 Player X enter move (row col): 21 1 1 2 3 Player X enter move (row col): 32 1 2 3 1 x 1 1 X 0 X -- - To 2 X O 3 OLX

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

Describe the job youd like to be doing five years from now.

Answered: 1 week ago

Question

So what disadvantages have you witnessed? (specific)

Answered: 1 week ago