CardDeck Class Reference

#include <carddeck.h>

Inheritance diagram for CardDeck:

Inheritance graph
[legend]
Collaboration diagram for CardDeck:

Collaboration graph
[legend]

List of all members.


Detailed Description

This is a deck of cards.

Author:
John Schneiderman

Public Member Functions

void addJoker ()
 CardDeck (vector< Card > cards, int numberOfDecks=1)
 CardDeck (int numberOfDecks=1)
void cutDeck ()
Card dealCard ()
int numberOfDecks () const
void removeCards (const Card &card)
void removeCards (Card::Rank rank)
void setNumberOfDecks (int numberOfDecks)
void shuffle ()

Protected Member Functions

void createDeck ()
CardSequence findMissingCards () const

Constructor & Destructor Documentation

CardDeck::CardDeck ( int  numberOfDecks = 1  ) 

This constructor creates a full-ready deck.

Parameters:
numberOfDecks is how many card decks to create in the deck.

CardDeck::CardDeck ( vector< Card cards,
int  numberOfDecks = 1 
)

This constructor creates a full-ready deck.

Parameters:
cards are the cards to exclude from the deck.
numberOfDecks is how many card decks to create in the deck.


Member Function Documentation

void CardDeck::addJoker (  ) 

This will add a joker card to the deck.

Note:
when this method is called, the deck is recreated, and the number of jokers is cumulative.

void CardDeck::createDeck (  )  [protected]

This creates an ordered deck of cards based the on suit and rank orders listed in the Card class.

Note:
This will clear the current deck.

This will initialise m_deckSize.

void CardDeck::cutDeck (  ) 

This randomly cuts the deck, and places the bottom half on top of the other half.

Note:
That the cut is guaranteed to be at least GUARANTEE_CUT_SIZE.

Card CardDeck::dealCard (  ) 

This removes a card off the top of the deck.

Returns:
the card removed from the top of the deck.

CardSequence CardDeck::findMissingCards (  )  const [protected]

Finds all the missing cards in the deck.

Returns:
the missing cards from the deck.

int CardDeck::numberOfDecks (  )  const

This gives the number of decks current used in the deck.

Returns:
the number of decks used.

void CardDeck::removeCards ( const Card card  ) 

This removes all cards of a specified card from the deck.

Parameters:
card is the card to remove.
Note:
When this method is called, the deck is recreated.

void CardDeck::removeCards ( Card::Rank  rank  ) 

This removes all cards of a specified rank from the deck.

Parameters:
rank is the ranks to remove.
Note:
When this method is called, the deck is recreated.

void CardDeck::setNumberOfDecks ( int  numberOfDecks  ) 

This sets how many card decks to create in the deck.

Parameters:
numberOfDecks is number of decks to create.
Note:
When this method is called, the deck is recreated.

void CardDeck::shuffle (  ) 

Fills any missing cards in the deck, and then shuffles the deck.


The documentation for this class was generated from the following files:

Generated on Tue Aug 12 23:24:01 2008 for KardsGT by  doxygen 1.5.5