|
|
|
|
|
|
|
if (onTable.CardAt(1).suit == onTable.CardAt(2).suit &&
onTable.CardAt(1).suit == onTable.CardAt(3).suit)
MoveFour(); // Four alike
else
MoveTwo(); // 1st and 4th alike
else
moveMade = FALSE;
}
//******************************************************************
void Player::MoveFour()
// Moves the first four cards from onTable to discardPile
// Precondition:
// Length of onTable >= 4
// Postcondition:
// The first four cards have been removed from onTable and
// placed at the front of discardPile
{
CardType tempCard; // Temporary card
int count; // Loop counter
for (count = 1; count <= 4; count++)
{
onTable.RemoveTop(tempCard);
discardPile.InsertTop(tempCard);
}
}
//******************************************************************
void Player::MoveTwo()
// Moves the second and third cards from onTable to discardPile
// Precondition:
// Length of onTable >= 4
// Postcondition:
// The second and third cards have been removed from onTable and
// placed at the front of discardPile
// && The first card in onTable at entry is still the first card
// in onTable
{ |
|
|
|
|
|