< Previous | Contents | Next >
This function gets a piece (either an ’X’ or an ’O’) and returns the opponent’s piece (either an ’X’ or an ’O’).
char opponent(char piece)
{
if (piece == X)
return O;
}
else
return X;