00001 #ifndef MMANN_FCTALONSTATE_H 00002 #define MMANN_FCTALONSTATE_H 00003 00011 00012 #include "FCState.h" 00013 #include "FCEnums.h" 00014 #include "CompareAlgorithms.h" 00015 #include "HashAlgorithms.h" 00016 #include "AGenericTree.h" 00017 #include "FCInternalHash.h" 00018 00019 class MD5TalonStateDataHashAlgorithm; 00020 00022 #define FC_TALON_PARAM_LENGTH 0 00023 00024 #define FC_TALON_PARAM_POSITION 1 00025 00026 #define FC_TALON_PARAM_KLONDIKE_STACK_POSITION 0 00027 00028 #define FC_TALON_PARAM_KLONDIKE_QUEUE_POSITION 1 00029 00030 #define FC_TALON_PARAM_KLONDIKE_NUMBER_OF_REDEALS_LEFT 2 00031 00032 #define FC_TALON_NUMBER_OF_TALON_PARAMETERS 3 00033 00035 class FCSTalonStateData 00036 { 00037 public: 00039 FCSTalonStateData(); 00040 00042 virtual ~FCSTalonStateData(); 00043 00044 friend class MD5TalonStateDataHashAlgorithm; 00045 00049 virtual void Copy(FCSTalonStateData* Data); 00050 00054 virtual int Compare(const FCSTalonStateData* TalonData); 00055 00059 void SetKlondikeNumberOfRedealsLeft(char RedealsLeft); 00060 00064 char GetKlondikeNumberOfRedealsLeft(); 00065 00069 void SetTalonPosition(char Position); 00070 00074 char GetTalonPosition(); 00075 00079 void SetTalonLength(char Length); 00080 00084 char GetTalonLength(); 00085 00089 void SetKlondikeTalonLength(char Length); 00090 00094 char GetKlondikeTalonLength(); 00095 00099 void SetKlondikeTalonStackPosition(char Position); 00100 00104 char GetKlondikeTalonStackPosition(); 00105 00109 void SetKlondikeTalonQueuePosition(char Position); 00110 00114 char GetKlondikeTalonQueuePosition(); 00115 00117 void KlondikeTalonRedealBare(); 00118 00120 virtual void KlondikeTalonQueueToStack() = 0; 00121 00125 virtual FCSCard* GetKlondikeTalonTopCard() = 0; 00126 00131 virtual FCSCard* GetTalon(int Position) = 0; 00132 00133 protected: 00135 char m_TalonParams[FC_TALON_NUMBER_OF_TALON_PARAMETERS]; 00136 00138 char m_KlondikeTalonLength; 00139 00140 }; 00141 00142 00144 #define TALON_PARAM_HASH_VALUE 72211 00145 00150 class MD5TalonStateDataHashAlgorithm : public MD5HashAlgorithm<FCSTalonStateData> 00151 { 00152 public: 00156 virtual int Hash(const FCSTalonStateData* key); 00157 }; 00158 00159 00161 class FCSTalonStateWithLocations : public FCSStateWithLocations 00162 { 00163 public: 00165 FCSTalonStateWithLocations(); 00166 00168 virtual ~FCSTalonStateWithLocations(); 00169 00178 static FCSStateWithLocations* CreateInitialState(const char *String, int NumberOfFreecells, 00179 int NumberOfStacks, int NumberOfDecks, FCSTalonType TalonType); 00188 virtual int CheckStateValidity(int NumberOfFreecells, int NumberOfStacks, 00189 int NumberOfDecks, FCSCard** MisplacedCard, FCSTalonType TalonType); 00190 00195 virtual void StateAsString(char* String, FCSDebugDisplayInfo* DebugInfo); 00196 00201 virtual FCSCard* GetTalon(int Position); 00202 00206 virtual void CacheTalonStacks(FCInternalHash<FCSTalonStateData, void>* TalonHash) = 0; 00207 00211 virtual void CreateTalons(int NumberOfTalons) = 0; 00212 00216 virtual FCSTalonStateData* GetTalonData() = 0; 00217 00219 virtual void DecrementKlondikeTalonStack() = 0; 00220 }; 00221 00225 FCSTalonStateData* CreateTalonStateData(); 00226 00227 #endif