This is for C++ Programming. Please explain each part in the code and the functi
ID: 3810373 • Letter: T
Question
This is for C++ Programming. Please explain each part in the code and the functions needed. Thank you.
Write a program to play the game lsolation. Game Instructions There are two players "x" and "0". Either player can go first Each player can move horizontal, vertical, or diagonal, 1 or more spaces The space the player leaves is now blocked, and neither player can move to that space anymore A player cannot jump over a blocked space, or the other player The game is over when a player has no more legal moves. The player that runs out of moves to make loses. The goal is to block in your opponent, so they have nowhere left to move. Guidelines The start state is the image above Your program can be "X" or "O" You program or the human should be able to go first Your program should be written in C++. Your program should take no more than 30 seconds to move Game continues to play until someone winsExplanation / Answer
char num[10] = {'0','1','2','3','4','5','6','7','8','8','9','9'};
int win;
void play();
int main()
{
int player = 1,i, choice;
char tictac;
do{
play();
cout<<"player"<<"enter a symbol";
cin>>choice;
tictac = (player ==1) ? 'X' : 'O';
if(choice == 1 && num[1] = '1')
num[1] = tictac;
else if (choice == 2 && num[2] == '2')
num[2] = tictac;
else if (choice == 3 && num[3] == '3')
num[3] = tictac;
else if (choice == 4 && num[4] == '4')
num[4] = tictac;
else if (choice == 5 && num[5] == '5')
num[5] = tictac;
else if (choice == 6 && num[6] == '6')
num[6] = tictac;
else if (choice == 7 && num[7] == '7')
num[7] = tictac;
else if (choice == 8 && num[8] == '8')
num[8] = tictac;
else if (choice == 9 && num[9] == '9')
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.