O'Reilly logo

Joy of Patterns: Using Patterns for Enterprise Development, The by Brandon Goldfedder

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

deck.cpp

 // Deck body // Brandon Goldfedder #include <algorithm> #include "deck.h" Deck::Deck() { } Deck::~Deck() { } void Deck::BurnIt() { actualDeck.erase(actualDeck.begin(), actualDeck.end()); } void Deck::AddDeck(unsigned int numDecks) { const unsigned int NUMVALUES = 13; const unsigned int NUMSUITS = 4; const char cardValues[NUMVALUES] = {'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K'}; const Card::SUIT suitValues[NUMSUITS] = { Card::HEART, Card::DIAMOND, Card::SPADE, Card::CLUB}; Card crd; for (int count = 0; count < numDecks; count++) { for (int i = 0; i < NUMSUITS; i++) { crd.SetSuit(suitValues[i]); for (int j = 0; j < NUMVALUES; j++) { crd.SetType(cardValues[j]); actualDeck.push_back(crd); } } } } void Deck::Shuffle() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required