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.h

// Deck header
// Brandon Goldfedder

#ifndef _DECK
#define _DECK
#include <vector>
#include "card.h"

// Deck represents a group of >=0 sets of 52 cards

class Deck {
public:
   Deck();
   ~Deck();
   void BurnIt(); // Destroy all cards in the decks
   void AddDeck(unsigned int numDecks = 1); // Adds numDecks
      of Cards into the Deck, does not shuffle it in
   void Shuffle(); // Shuffle all cards currently in the deck
   bool GetCard(Card* card); // Draw the top card (if any) from
      the deck, return if this was successful (any cards left)
   unsigned int RemainingCards();
private:
   std::vector<Card> actualDeck; // We will use a deque to
   // store the set of cards
   };

#endif

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