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

FCState.h

Go to the documentation of this file.
00001 #ifndef MMANN_FCSTATE_H
00002 #define MMANN_FCSTATE_H
00003 
00011 
00012 #include "FCEnums.h"
00013 #include "FCSMove.h"
00014 #include "FCSCard.h"
00015 #include "Config.h"
00016 #include "FCSDebugDisplayInfo.h"
00017 #include "HashAlgorithms.h"
00018 #include "FCSStateWithLocationsMatrix.h"
00019 
00020 //forward declaration
00021 class AFCSGenericStackStorage;
00022 
00024 class FCSState
00025 {
00026 public:
00028     virtual ~FCSState();
00029 
00033     virtual int GetClassSize() = 0;
00034 
00035 protected:
00037     FCSState();
00038 };
00039 
00042 class FCSStateWithLocations
00043 {
00044 public: 
00045 
00047     virtual ~FCSStateWithLocations();
00048 
00052     virtual void Copy(FCSStateWithLocations* State);
00053 
00059     virtual int Compare(const FCSStateWithLocations* State) = 0;
00060 
00068     static FCSStateWithLocations* CreateInitialState(const char *String, 
00069                                                     int NumberOfFreecells, int NumberOfStacks, int NumberOfDecks);
00070 
00075     virtual void StateAsString(char* String, FCSDebugDisplayInfo* DebugInfo);
00076 
00085     virtual int CheckStateValidity(int NumberOfFreecells, int NumberOfStacks, 
00086                                     int NumberOfDecks, FCSCard** MisplacedCard, FCSTalonType TalonType);
00087 
00093     virtual FCSCard* GetStackCard(int Stack, int Card) = 0;
00094 
00100     virtual char GetStackCardSuit(int Stack, int Card) = 0;
00101 
00107     virtual char GetStackCardNumber(int Stack, int Card) = 0;
00108 
00113     virtual int GetStackLength(int Stack) = 0;
00114 
00119     virtual FCSCard* GetFreecellCard(int Freecell) = 0;
00120 
00125     virtual char GetFreecellCardSuit(int Freecell) = 0;
00126 
00131     virtual char GetFreecellCardNumber(int Freecell) = 0;
00132 
00137     virtual char GetFoundation(int Foundation) = 0;
00138 
00142     virtual void IncrementFoundation(int Foundation) = 0;
00143 
00148     virtual void SetFoundation(int Foundation, char Value) = 0;
00149 
00154     virtual void PopStackCard(int Stack, FCSCard* Card) = 0;
00155 
00161     virtual void PushStackCardIntoStack(int DestStack, int SrcStack, int SrcCard) = 0;
00162 
00167     virtual void PushCardIntoStack(int DestStack, FCSCard* Card) = 0;
00168 
00173     virtual void PutCardInFreecell(int Freecell, FCSCard* Card) = 0;
00174 
00178     virtual void EmptyFreecell(int Freecell) = 0;
00179 
00184     virtual void FlipStackCard(int Stack, int Card) = 0;
00185 
00187     virtual void CleanState();
00188 
00192     virtual void CacheStacks(AFCSGenericStackStorage* Storage, int StackNumber);
00193 
00195     virtual void Initialize(int NumberOfStacks);
00196 
00201     virtual void CanonizeState(int NumberOfFreecells, int NumberOfStacks) = 0;
00202 
00206     virtual FCSState* GetState() = 0;
00207 
00209     FCSStateWithLocations* m_Parent;
00211     FCSMoveStack* m_MovesToParent;
00213     int m_Depth;
00215     int m_Visited;
00217     int m_VisitIterations;
00219     char m_StackLocations[MAX_NUM_STACKS];
00221     char m_FreecellLocations[MAX_NUM_FREECELLS];
00222 
00223 protected:
00225     FCSStateWithLocations();
00226 };
00227 
00229 class FCSStateWithLocationsLinkedList
00230 {
00231 public:
00233     FCSStateWithLocations* m_State;
00234 
00236     FCSStateWithLocationsLinkedList* m_Next;
00237 };
00238 
00242 int GetFCSStateWithLocationsClassSize();
00243 
00248 FCSStateWithLocations* CreateStateWithLocations();
00249 
00254 AFCSStateWithLocationsMatrix* CreateStateWithLocationsMatrix(int Size);
00255 
00263 void ReallocStateWithLocationsArray(FCSStateWithLocations*** Array, int OldSize, int NewSize);
00264 
00273 FCSStateWithLocations* CreateInitialState(const char *String, int NumberOfFreecells, 
00274                                           int NumberOfStacks, int NumberOfDecks, FCSTalonType TalonType);
00275 
00280 class MD5StateWithLocationsHashAlgorithm : public MD5HashAlgorithm<FCSStateWithLocations>
00281 {
00282 public:
00286     virtual int Hash(const FCSStateWithLocations* key);
00287 };
00288 
00289 extern FCStateType GlobalStateType;
00290 
00291 #endif

Generated on Sat Nov 5 11:20:16 2005 for Cpp Freecell Solver by  doxygen 1.4.4