Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Check if played card in player 1's hand */
- // !!!!!!!!!!!!!!!!
- // bug where rank is undefined for some reason??? //
- // !!!!!!!!!!!!!!!!
- card topcard = holderContainer.accessPoppedData()->getTopCard();
- cout << topcard.getRankAsString() << endl;
- cout << topcard.getSuitAsString() << endl;
- cardDeck *p1Deck = player1Container.accessPoppedData();
- //
- bool found = false;
- cout << " Print card in players hand" << endl;
- card cardToAdd = p1Deck->getCard(topcard, found);
- if (found == true)
- {
- cout << "Player 1 has a matching card!" << endl;
- cout << cardToAdd.getRankAsString() << endl;
- cout << cardToAdd.getSuitAsString() << endl;
- // remove card from players deck and add to played cards deck
- // check size of player 1's deck, if 0 = p1 wins else move to p2
- }
- else
- {
- cout << "Player 1 has no matching cards" << endl;
- cout << "Player 1 draws a card" << endl;
- // add card from container deck to player 1 deck
- }
- /* similar code to above for player 2 */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement