Question: below is starter code for a program thats ment to play tic tac toe. ive been tinkering with the 4 functons to make the program
below is starter code for a program thats ment to play tic tac toe. ive been tinkering with the functons to make the program work with no sucess. please keep it as simple and clean as possible and have it be able to run a tic tat toe game. please repond if any more info is needed.
constants
const char SIGILXO;
prototypes
int winnerint board;
bool isGameOverint board;
void drawBoardint board;
bool isMoveLegalint board int, int;
return if player X has won
return if player O has won
return if neither player has won
int winnerint board
return ;
using this board as a guide
draw the board using for empty squares
or X or O for player or player
void drawBoardint board
cout endl;
cout endl;
cout endl;
cout endl;
return false if row or column are out of bounds
or if that spot on the board is already taken
otherwise return true
bool isMoveLegalint board int row, int column
return true;
if any player has three in a row or if the board is full
return true otherwise return false
bool isGameOverint board
if winnerboard winnerboard return true;
forint r; r; r
for int c; c; c
if boardrc
return false;
return true;
int main
int board; for empty square, or for taken squares
int player ;
int row, column, result;
bool legalMove;
starting board
drawBoardboard;
whileisGameOverboard
cout "Player player SIGILplayer your move?";
cin row column;
legalMove isMoveLegalboard row, column;
whilelegalMove
cout "Player player SIGILplayer your move?";
cin row column;
legalMove isMoveLegalboard row, column;
boardrowcolumn player;
drawBoardboard;
player player;
game over
result winnerboard;
if result
cout "Tie Game" endl;
else
cout "Player result SIGILresult wins!" endl;
return ;
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
