Question: Constructor Player::Player ( bool isAI ) Getters size _ t Player::getHandSize ( ) Note: size _ t is a special numeric type guaranteed to be
Constructor
Player::Playerbool isAI
Getters
sizet Player::getHandSize
Note: sizet is a special numeric type guaranteed to be able to hold the size of any object. It functions basically the same as unsigned int.
string Player::getHandString
Returns a string representation of the players hand.
Cards should be listed from the front of the hand oldest card to the back newest card
The rank and suit of a card should be separated by a space
Consecutive cards should be separated by a comma and a space
For example, if the cards in the players hand are the of Hearts and the of Diamonds, this method should return: Hearts, Diamonds
Methods Member Functions
void Player::addToHandCard c
Add the given card to this players hand.
The hand should be ordered from least recently added to most recently added ie new cards should go at the back of the hand
Card Player::playCardvector const& suits, string& currentRank, string& currentSuit
Choose a card to play, remove it from the players hand and return it
Make sure to increment the cards timesPlayed and to update the current rank and suit
If the player chooses not to play a card perhaps because they have no card they can play return nullptr to indicate that they are drawing a card.
The process of choosing a card to play is different for AI players and for humans
The AI will always play the first card from its hand that it can legally play, or draw a card if it has no cards it can play
For human players, you must tell them the current rank and suit and ask them to choose a card to play by entering two strings.
Prompt the player to choose again if they choose a card they dont have or a card they have in hand cannot play see the sample execution above
Upon playing an a player has the opportunity to change the current suit to any suit in the game
The AI will always choose to use the suit of the
Human players should be prompted to pick a suit
Make sure to check whether the suit they choose is actually present in this deck
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
