Question: while ( currentGame - > currentGameState = = GameState::StillPlaying ) { if ( currentGame - > currentTurn ! = currentPlayer - > type ) {

while (currentGame->currentGameState == GameState::StillPlaying)
{
if (currentGame->currentTurn != currentPlayer->type)
{
printf("ERROR: Wrong player is playing. You broke it.
");
Pause();
exit(1);
}
currentGame->currentTurn =(currentPlayer->type == 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.
currentGame->currentGameState = MakeAMove(currentPlayer, currentGame);
PrintGameBoard(currentGame);
switch (currentGame->currentGameState)
{
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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!