CardProperties Class Reference

#include <cardproperties.h>

Collaboration diagram for CardProperties:

Collaboration graph
[legend]

List of all members.


Detailed Description

This is designed to determine the unique properties of a sequence of cards.

Author:
John Schneiderman

Public Types

enum  PublicConstants { MAXIMUM_SEQUENCE_SIZE = 20 }

Public Member Functions

 CardProperties (const CardSequence &sequence)
 CardProperties ()
vector< CardSequencecombinations () const
vector< CardSequencedoubletons () const
vector< CardSequenceflushes () const
vector< CardSequencepairs () const
CardSequence ranks (Card::Rank rank) const
vector< CardSequenceruns () const
const CardSequencesequence () const
void setSequence (const CardSequence &sequence)
vector< Cardsingletons () const
CardSequence suits (Card::Suit suit) const
vector< CardSequencesummations (int goal, const RuleBase &rules) const

Protected Types

enum  PropertyRules {
  SINGLETON = 1, DOUBLETON = 2, PAIR = 2, RUN = 3,
  FLUSH = 4
}

Protected Member Functions

vector< CardSequenceparseCardSequence (const CardSequence &seq) const
vector< CardSequenceuniqueSequences (const vector< CardSequence > &examineSequence) const

Member Enumeration Documentation

These are the rules used to determine what patterns constitutes something in a sequence of cards.

Parameters:
SINGLETON is when in the sequence you only have one card in a suit.
DOUBLETON is when in the sequence you only have two cards in a suit.
PAIR is when in the sequence you have cards of the same rank.
RUN is when in the sequence you have cards increasing in sequence by one.
FLUSH is when in the sequence you have cards of the same suit.

These are all the public constants.

Parameters:
MAXIMUM_SEQUENCE_SIZE is the largest sequence we can reasonably parse.


Constructor & Destructor Documentation

CardProperties::CardProperties (  ) 

Default constructor.

CardProperties::CardProperties ( const CardSequence sequence  ) 

This constructor is used to start off with a card sequence.

Parameters:
sequence is the card sequence you wish to determine the properties of.
Exceptions:
KardsGTError if the sequence size is too large to reasonably parse.


Member Function Documentation

vector< CardSequence > CardProperties::combinations (  )  const

This gives all the combinations of the sequence we're examining.

Returns:
the card combinations for the sequence.

vector< CardSequence > CardProperties::doubletons (  )  const

This goes through our sequence and finds all doubletons.

Returns:
all doubletons found in the sequence of cards.

vector< CardSequence > CardProperties::flushes (  )  const

This goes through our sequence and finds all the unique flushes.

Returns:
the largest unique flushes that can be found in the sequence of cards.

vector< CardSequence > CardProperties::pairs (  )  const

This goes through our sequence and finds all pairs.

Returns:
each unique pair that is found in the sequence of cards.

vector< CardSequence > CardProperties::parseCardSequence ( const CardSequence seq  )  const [protected]

This goes through the card sequence and arranges them according to a binary ordering.
For example: QS, KS, JS would return the following combinations:
JS
QS
QS JS
KS
KS JS
KS QS
KS QS JS

Parameters:
seq is the card sequence to parse and expand, generating the combinations.
Returns:
an array filled with all possible unique combinations for the card sequence.

CardSequence CardProperties::ranks ( Card::Rank  rank  )  const

This goes through our sequence and finds all the cards of a specific rank.

Parameters:
rank is the rank we're looking for.
Returns:
all the suits that match the rank we want.

vector< CardSequence > CardProperties::runs (  )  const

This goes through our sequence and finds all the unique runs.

Returns:
the longest unique runs found in the sequence of cards.

const CardSequence & CardProperties::sequence (  )  const

This gives you the sequence that we're examining.

Returns:
the card sequence that we're examining.

void CardProperties::setSequence ( const CardSequence sequence  ) 

This sets the sequence of cards you want to examine.

Parameters:
sequence is the sequence of cards you want to examine.
Exceptions:
KardsGTError if the sequence size is too large to reasonably parse.

vector< Card > CardProperties::singletons (  )  const

This goes through our sequence and finds all singletons.

Returns:
all singletons found in the sequence of cards.

CardSequence CardProperties::suits ( Card::Suit  suit  )  const

This goes through our sequence and finds all the cards of a specific suit.

Parameters:
suit is the suit we're looking for.
Returns:
all the suits that match the suit we want.

vector< CardSequence > CardProperties::summations ( int  goal,
const RuleBase rules 
) const

This goes through our sequence and finds all combinations whose sum equals a specified value.

Parameters:
goal is the value you aspire to combine to using the sequence of cards.
rules is the specific rules for the card game being played.
Returns:
the unique combinations that sum up to goal.

vector< CardSequence > CardProperties::uniqueSequences ( const vector< CardSequence > &  examineSequence  )  const [protected]

Searches through and finds all unique sequences.

Note:
A unique sequence is a sequence that has a card that is not in any of the other sequences.
Parameters:
examineSequence is the sequences to examine.
Returns:
the unique sequences found.


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