Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

FCSCard Class Reference

This class represents card behavior. More...

#include <FCSCard.h>

Inheritance diagram for FCSCard:

FCSCompactCard FCSDebugCard FCSIndirectCard List of all members.

Public Member Functions

void User2Perl (const char *String)
 This function converts an entire card from its string representations (e.g: "AH", "KS", "8D") to a FCSCard datatype.
char * Perl2User (char *String, int Display10AsT, bool DisplayDebug)
 Convert a card to its string representation.
char * Perl2UserSuit (int Suit, char *String, bool *CardNumberIsNull, int Flipped, bool DisplayDebug)
 Converts a suit to its user representation.
virtual void Copy (FCSCard *Card)=0
 Copy the value of a card into a card.
int Compare (FCSCard *Card)
 Compare a card to another.
virtual void EmptyCard ()=0
 Make card have no value.
virtual bool IsEmptyCard ()=0
 Determines whether or not card is empty.
virtual char GetCardNumber ()=0
 Retrieves card number.
virtual char GetSuit ()=0
 Retrieves suit.
virtual char GetFlipped ()=0
 Retrieves whether or not card is flipped (visible).
virtual void SetSuit (char Suit)=0
 Set suit of card.
virtual void SetCardNumber (char CardNumber)=0
 Set card number of card.
virtual void SetFlipped (char Flipped)=0
 Set flippedness (visibility) of card.
virtual int GetClassSize ()=0
 Get the size of FCSCard child class.

Static Public Member Functions

static FCSCardCreate ()
 Create a card.
static char * Perl2UserCardNumber (int Number, char *String, bool *CardNumberIsNull, int Display10AsT, int Flipped, bool DisplayDebug)
static int User2PerlCardNumber (const char *String)
 Converts a card number from a string (e.g: "A", "K", "9") to an integer.
static int User2PerlSuit (const char *String)
 Converts a string containing a suit letter (e.g: "H", "S","D", "C") into its suit ID. The suit letter may be after the start of the string.

Protected Member Functions

int User2PerlFlippedStatus (const char *String)
 Converts flipped status of a card from a string to an integer.

Detailed Description

This is an abstract class. It provides functionality to turn cards into a string representation and vice versa. It also provides pure virtual functions for the behavior of a card

Definition at line 19 of file FCSCard.h.


Member Function Documentation

int FCSCard::Compare FCSCard Card  ) 
 

Parameters:
Card to be compared to
Returns:
-1 if this card < Card, 1 if card > Card, 0 if card = Card

Definition at line 41 of file FCSCard.cpp.

References GetCardNumber(), and GetSuit().

Referenced by FCSIndirectStateWithLocations< StateWithLocation >::CanonizeState(), FCSDebugStateWithLocations< StateWithLocation >::CanonizeState(), FCSCompactStateWithLocations< StateWithLocation >::CanonizeState(), FCSIndirectCardCompareAlgorithm< Data, ConfigData >::Compare(), FCSIndirectState::StackCompare(), FCSDebugState::StackCompare(), FCSCompactState::StackCompare(), and FCSIndirectState::StackSortCompare().

virtual void FCSCard::Copy FCSCard Card  )  [pure virtual]
 

Parameters:
Card is the card to be copied

Implemented in FCSCompactCard, FCSDebugCard, and FCSIndirectCard.

Referenced by FCSAStarSolvingAlgorithm< SolvingAlgorithmType >::AStarRateState(), FCSTalonStateWithLocations::CreateInitialState(), FCSTalonSolvingAlgorithm::GetCardFromKlondikeTalon(), FCSAStarSolvingAlgorithm< SolvingAlgorithmType >::InitAStar(), FCSFreecellSolvingAlgorithm::MoveStackCardsToAParentOnTheSameStack(), FCSIndirectStateWithLocations< StateWithLocation >::PopStackCard(), FCSDebugStateWithLocations< StateWithLocation >::PopStackCard(), and FCSCompactStateWithLocations< StateWithLocation >::PopStackCard().

FCSCard * FCSCard::Create  )  [static]
 

Returns:
Pointer to new card

Definition at line 23 of file FCSCard.cpp.

References GlobalStateType.

Referenced by ApplyMove(), FCSAStarSolvingAlgorithm< SolvingAlgorithmType >::AStarRateState(), FCSTalonStateWithLocations::CheckStateValidity(), FCSStateWithLocations::CheckStateValidity(), FCSTalonStateWithLocations::CreateInitialState(), FCSStateWithLocations::CreateInitialState(), FCSFreecellSolvingAlgorithm::EmptyStackIntoFreecells(), FCSTalonSolvingAlgorithm::GetCardFromKlondikeTalon(), FCSAStarSolvingAlgorithm< SolvingAlgorithmType >::InitAStar(), FCSFreecellSolvingAlgorithm::MoveCardsToADifferentParent(), FCSFreecellSolvingAlgorithm::MoveFreecellCardsToTopOfStacks(), FCSFreecellSolvingAlgorithm::MoveNonTopStackCardsToFounds(), FCSFreecellSolvingAlgorithm::MoveSequencesToFreeStacks(), FCSSimpleSimonSolvingAlgorithm::MoveSequenceToFalseParent(), FCSSimpleSimonSolvingAlgorithm::MoveSequenceToFounds(), FCSSimpleSimonSolvingAlgorithm::MoveSequenceToParentOnTheSameStack(), FCSSimpleSimonSolvingAlgorithm::MoveSequenceToTrueParent(), FCSSimpleSimonSolvingAlgorithm::MoveSequenceToTrueParentWithSomeCardsAbove(), FCSSimpleSimonSolvingAlgorithm::MoveSequenceWithJunkSequenceAboveToTrueParentWithSomeCardsAbove(), FCSSimpleSimonSolvingAlgorithm::MoveSequenceWithSomeCardsAboveToTrueParent(), FCSFreecellSolvingAlgorithm::MoveStackCardsToAParentOnTheSameStack(), FCSFreecellSolvingAlgorithm::MoveStackCardsToDifferentStacks(), FCSFreecellSolvingAlgorithm::MoveTopStackCardsToFounds(), FCSSimpleSimonSolvingAlgorithm::MoveWholeStackSequenceToFalseParent(), and FCSSimpleSimonSolvingAlgorithm::MoveWholeStackSequenceToFalseParentWithSomeCardsAbove().

virtual char FCSCard::GetCardNumber  )  [pure virtual]
 

Returns:
Card Number of card

Implemented in FCSCompactCard, FCSDebugCard, and FCSIndirectCard.

Referenced by FCSTalonStateWithLocations::CheckStateValidity(), Compare(), FCSTalonSolvingAlgorithm::GetCardFromKlondikeTalon(), FCSFreecellData::IsParentCard(), FCSSimpleSimonSolvingAlgorithm::IsSimpleSimonFalseParent(), FCSFreecellSolvingAlgorithm::MoveFreecellCardsToEmptyStack(), FCSFreecellSolvingAlgorithm::MoveFreecellCardsToFounds(), FCSFreecellSolvingAlgorithm::MoveFreecellCardsToTopOfStacks(), FCSFreecellSolvingAlgorithm::MoveNonTopStackCardsToFounds(), FCSFreecellSolvingAlgorithm::MoveSequencesToFreeStacks(), FCSFreecellSolvingAlgorithm::MoveStackCardsToAParentOnTheSameStack(), FCSFreecellSolvingAlgorithm::MoveTopStackCardsToFounds(), and Perl2User().

virtual int FCSCard::GetClassSize  )  [pure virtual]
 

Returns:
Size of state class

Implemented in FCSCompactCard, FCSDebugCard, and FCSIndirectCard.

virtual char FCSCard::GetFlipped  )  [pure virtual]
 

Returns:
Visibility of card

Implemented in FCSCompactCard, FCSDebugCard, and FCSIndirectCard.

Referenced by FCSFreecellSolvingAlgorithm::FlipTopCard(), FCSFreecellSolvingAlgorithm::MoveStackCardsToDifferentStacks(), and Perl2User().

virtual char FCSCard::GetSuit  )  [pure virtual]
 

Returns:
Suit of card

Implemented in FCSCompactCard, FCSDebugCard, and FCSIndirectCard.

Referenced by FCSTalonStateWithLocations::CheckStateValidity(), Compare(), FCSTalonSolvingAlgorithm::GetCardFromKlondikeTalon(), FCSFreecellData::IsParentCard(), FCSSimpleSimonSolvingAlgorithm::IsSimpleSimonTrueParentSuit(), FCSFreecellSolvingAlgorithm::MoveFreecellCardsToFounds(), FCSFreecellSolvingAlgorithm::MoveNonTopStackCardsToFounds(), FCSSimpleSimonSolvingAlgorithm::MoveSequenceToTrueParentWithSomeCardsAbove(), FCSSimpleSimonSolvingAlgorithm::MoveSequenceWithSomeCardsAboveToTrueParent(), FCSFreecellSolvingAlgorithm::MoveStackCardsToAParentOnTheSameStack(), FCSFreecellSolvingAlgorithm::MoveTopStackCardsToFounds(), and Perl2User().

char * FCSCard::Perl2User char *  String,
int  Display10AsT,
bool  DisplayDebug
 

Parameters:
String will be the new string representation
Display10AsT whether 10 should be printed as T or not
DisplayDebug determines whether or not to display debug information
Returns:
A pointer to the string

Definition at line 66 of file FCSCard.cpp.

References GetCardNumber(), GetFlipped(), GetSuit(), Perl2UserCardNumber(), and Perl2UserSuit().

Referenced by FCSDebugDisplayInfo::Display(), FCSTalonStateWithLocations::StateAsString(), FCSStateWithLocations::StateAsString(), and FCCommandLineArguments::Verify().

char * FCSCard::Perl2UserCardNumber int  Number,
char *  String,
bool *  CardNumberIsNull,
int  Display10AsT,
int  Flipped,
bool  DisplayDebug
[static]
 

Converts a card number from its internal representation to a string.

Parameters:
Number is the card number
String is the string to output to.
CardNumberIsNull a pointer to a bool that indicates whether the card number is out of range or equal to zero
Display10AsT is whether 10 should be printed as T or not
Flipped is whether the card is flipped or not
DisplayDebug determines whether or not to display debug information
Returns:
A pointer to the string

Definition at line 89 of file FCSCard.cpp.

References CardMap10, and CardMapT.

Referenced by Perl2User(), FCSTalonStateWithLocations::StateAsString(), and FCSStateWithLocations::StateAsString().

char * FCSCard::Perl2UserSuit int  Suit,
char *  String,
bool *  CardNumberIsNull,
int  Flipped,
bool  DisplayDebug
 

Parameters:
Suit is the card suit
String is the string to output to.
CardNumberIsNull a pointer to a bool that indicates whether the card number is out of range or equal to zero
Flipped is whether the card is flipped or not
DisplayDebug determines whether or not to display debug information
Returns:
A pointer to the string

Definition at line 123 of file FCSCard.cpp.

Referenced by Perl2User().

virtual void FCSCard::SetCardNumber char  CardNumber  )  [pure virtual]
 

Parameters:
New card number of card

Implemented in FCSCompactCard, FCSDebugCard, and FCSIndirectCard.

Referenced by User2Perl().

virtual void FCSCard::SetFlipped char  Flipped  )  [pure virtual]
 

Parameters:
New visibility of card

Implemented in FCSCompactCard, FCSDebugCard, and FCSIndirectCard.

Referenced by FCSFreecellSolvingAlgorithm::FlipTopCard(), and User2Perl().

virtual void FCSCard::SetSuit char  Suit  )  [pure virtual]
 

Parameters:
New suit of card

Implemented in FCSCompactCard, FCSDebugCard, and FCSIndirectCard.

Referenced by User2Perl().

void FCSCard::User2Perl const char *  String  ) 
 

Parameters:
String is the string to be converted

Definition at line 59 of file FCSCard.cpp.

References SetCardNumber(), SetFlipped(), SetSuit(), User2PerlCardNumber(), User2PerlFlippedStatus(), and User2PerlSuit().

Referenced by FCSTalonStateWithLocations::CreateInitialState(), and FCSStateWithLocations::CreateInitialState().

int FCSCard::User2PerlCardNumber const char *  String  )  [static]
 

Parameters:
String is the string to be converted
Returns:
Card number as an integer

Definition at line 161 of file FCSCard.cpp.

References MakeUpperCase.

Referenced by FCSTalonStateWithLocations::CreateInitialState(), FCSStateWithLocations::CreateInitialState(), and User2Perl().

int FCSCard::User2PerlFlippedStatus const char *  String  )  [protected]
 

Parameters:
String is the string to be converted
Returns:
Flipped status as an integer

Definition at line 233 of file FCSCard.cpp.

Referenced by User2Perl().

int FCSCard::User2PerlSuit const char *  String  )  [static]
 

Parameters:
String is the string to be converted
Returns:
Suit as an integer

Definition at line 203 of file FCSCard.cpp.

References MakeUpperCase.

Referenced by FCSTalonStateWithLocations::CreateInitialState(), FCSStateWithLocations::CreateInitialState(), and User2Perl().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 11:20:17 2005 for Cpp Freecell Solver by  doxygen 1.4.4