00001 #ifndef FCS_FREECELL_ALGORITHM_H 00002 #define FCS_FREECELL_ALGORITHM_H 00003 00011 00012 #include "FCEnums.h" 00013 #include "FCState.h" 00014 #include "FCSDerivedStates.h" 00015 00016 /* 00017 * Conventions for use of the tests' order flags: 00018 * A test that should be scanned sequentially should have both flags cleared. 00019 * The first test in its random group should have both flags set. All the 00020 * other tests in the group should contain the FLAG_RANDOM flag. 00021 * 00022 * For instance: 123(45)(67)8 translates into: 00023 * 1 , 2, 3, 4|RANDOM|START_RANDOM_GROUP, 5|RANDOM, 00024 * 6|RANDOM_START_RANDOM_GROUP, 7|RANDOM, 8 00025 * 00026 * */ 00028 enum FCS_TESTS_ORDER_FLAGS 00029 { 00030 FCS_TEST_ORDER_NO_FLAGS_MASK = 0xFFFFFF, 00031 FCS_TEST_ORDER_FLAG_RANDOM = 0x1000000, 00032 FCS_TEST_ORDER_FLAG_START_RANDOM_GROUP = 0x2000000 00033 }; 00034 00036 class FCSFreecellAlgorithm 00037 { 00038 public: 00039 00045 virtual FCSStateSolvingReturnCodes Solve(FCSStateWithLocations* StateWithLocations, int Depth) = 0; 00046 00051 virtual FCSStateSolvingReturnCodes Resume(int Depth) = 0; 00052 00053 protected: 00055 void DeleteDerived(FCSDerivedStatesList* Derive); 00056 00066 virtual FCSStateSolvingReturnCodes RunTest(int TestNumber, FCSStateWithLocations* StateWithLocations, 00067 int Depth, int NumberOfFreeStacks, 00068 int NumberOfFreecells, 00069 FCSDerivedStatesList* DerivedStateList) = 0; 00070 00071 }; 00072 00073 #endif