Answered step by step
Verified Expert Solution
Question
1 Approved Answer
while ( currentGame - > currentGameState = = GameState::StillPlaying ) { if ( currentGame - > currentTurn ! = currentPlayer - > type ) {
while currentGamecurrentGameState GameState::StillPlaying
if currentGamecurrentTurn currentPlayertype
printfERROR: Wrong player is playing. You broke it
;
Pause;
exit;
currentGamecurrentTurn currentPlayertype PlayerType::X PlayerType::O : PlayerType::X;
Make a move on the game board. The result of this function will determine the current state of the board.
currentGamecurrentGameState MakeAMovecurrentPlayer currentGame;
PrintGameBoardcurrentGame;
switch currentGamecurrentGameState
case GameState::StillPlaying:
TODO:: The game is not over yet. We need to notify the other player that it's
their turn and then we must wait until they tell us it's our turn.
continue;
case GameState::Won:
TODO:: We have won the game, we must wake up the other player so they can break
out of the PlayGame function.
return;
case GameState::Draw:
TODO:: The game ended in a tie, we must wake up the other player so they can break
out of the PlayGame function
return;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started