...

/

Check for a Tie

Check for a Tie

Learn how can we check for a tie.

What we have

The game continues without the decision of winner/loser till the last vacant cell on the board. Here is the snap of the gameEnds() function, which calls the checkTie() function.

Press + to interact
bool gameEnds(char board[], char currentPlayer) {
if (checkWin(board, currentPlayer)) {
displayBoard(board);
cout << "\nPlayer " << currentPlayer << " wins!\n";
return true;
}
if (checkTie(board)) {
displayBoard(board);
cout << "\nThe game is a tie.\n";
return true;
}
return false;
}

What if all the places are taken and ...