Question: heres the TicTacToe program #include using namespace std; class TicTacToe { public: TicTacToe ( ) { for ( int i = 0 ; i <
heres the TicTacToe program #include
using namespace std;
class TicTacToe
public:
TicTacToe
forint i ; i ; i
forint j ; j ; i
boardij;
sigil;
sigilX;
sigilO;
void play;
private:
char sigil;
int board;
void drawBoard;
bool isMoveLegalint row, int column;
int winner;
bool isGameOver;
;
void TicTacToe::drawBoard
cout endl;
forint i ; i ; i
cout i ;
forint j ; j ; j
cout sigilboardij;
cout endl;
bool TicTacToe::isMoveLegalint row, int column
return row && row && column && column && boardrowcolumn;
int TicTacToe::winner
check rows and columns
forint i ; i ; i
ifboardi boardi && boardi boardi && boardi
return boardi;
ifboardi boardi && boardi boardi && boardi
return boardi;
check diagonals
ifboard board && board board && board
return board;
ifboard board && board board && board
return board;
return ;
bool TicTacToe::isGameOver
ifwinner
return true;
forint i ; i ; i
forint j ; j ; j
ifboardij
return false;
return true;
void TicTacToe:: play
int currentPlayer ;
whileisGameOver
drawBoard;
cout "player current player sigilcurrentPlayer enter your move row and column: ;
int row, column;
whileisMoveLegalrow column
cout "Invalid mve. Try again: ;
cin row column;
boardrowcolumn currentPlayer;
currentPlayer currentPlayer;
drawBoard;
int result winner;
ifresult
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
