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

FCSOptimizeSolvingAlgorithm< SolvingAlgorithmType > Class Template Reference

Optimize the solution to a game. More...

#include <FCSOptimizeSolvingAlgorithm.h>

Inheritance diagram for FCSOptimizeSolvingAlgorithm< SolvingAlgorithmType >:

FCSBFSSolvingAlgorithm< SolvingAlgorithmType > List of all members.

Public Member Functions

 FCSOptimizeSolvingAlgorithm (SolvingAlgorithmType *SolvingAlgorithm)
 Constructor with current solving algorithm.
virtual ~FCSOptimizeSolvingAlgorithm ()
 Destructor.
virtual FCSStateSolvingReturnCodes Solve (FCSStateWithLocations *StateWithLocations, int Depth)
 Solve the game.
virtual FCSStateSolvingReturnCodes Resume (int Depth)
 Resume solving a game.

Protected Member Functions

virtual bool CheckStateEnd (FCSStateWithLocations **NewStateWithLocations, FCSStateWithLocations *StateWithLocations, FCSDerivedStatesList **DerivedStateList, FCSMoveStack **Move, FCSMove **TempMove, int depth, FCSStateSolvingReturnCodes *ReturnCode)
 Put the last move onto the move stack for the current state.

Protected Attributes

int m_SavedNumberOfStatePacks
 Number of state packs in first solving algorithm.
AFCSStateWithLocationsMatrix ** m_SavedStatePacks
 Pointer to the state packs of the first solving algorithm.

Detailed Description

template<class SolvingAlgorithmType>
class FCSOptimizeSolvingAlgorithm< SolvingAlgorithmType >

Once a game has been solved, try to optimize the number of states and moves.

Definition at line 18 of file FCSOptimizeSolvingAlgorithm.h.


Constructor & Destructor Documentation

template<class SolvingAlgorithmType>
FCSOptimizeSolvingAlgorithm< SolvingAlgorithmType >::~FCSOptimizeSolvingAlgorithm  )  [virtual]
 

The original solving method will delete most of data, we just need to worry about the solution data we create

Definition at line 118 of file FCSOptimizeSolvingAlgorithm.h.

References FCSOptimizeSolvingAlgorithm< SolvingAlgorithmType >::m_SavedNumberOfStatePacks.


Member Function Documentation

template<class SolvingAlgorithmType>
bool FCSOptimizeSolvingAlgorithm< SolvingAlgorithmType >::CheckStateEnd FCSStateWithLocations **  NewStateWithLocations,
FCSStateWithLocations StateWithLocations,
FCSDerivedStatesList **  DerivedStateList,
FCSMoveStack **  Move,
FCSMove **  TempMove,
int  depth,
FCSStateSolvingReturnCodes ReturnCode
[inline, protected, virtual]
 

Parameters:
NewStateWithLocations is the state being added to storage
StateWithLocations is the current state
DerivedStateList is the derived state list for the current state
Move is how to get from StateWithLocations to NewStateWithLocations
TempMove is the last move from StateWithLocations to NewStateWithLocations
Depth is the current depth of the state
ReturnCode determines if the test is done
Returns:
Whether or not to return the ReturnCode

Definition at line 127 of file FCSOptimizeSolvingAlgorithm.h.

References CreateMoveStack(), FCSStateWithLocations::m_Depth, FCSStateWithLocations::m_MovesToParent, and FCSStateWithLocations::m_Parent.

template<class SolvingAlgorithmType>
FCSStateSolvingReturnCodes FCSOptimizeSolvingAlgorithm< SolvingAlgorithmType >::Resume int  Depth  )  [virtual]
 

Since the solution has already been acheived, this shouldn't be necessary, so it will just return FCS_STATE_IS_NOT_SOLVEABLE

Parameters:
Depth to continue at depth
Returns:
Solving return code

Reimplemented from FCSBFSSolvingAlgorithm< SolvingAlgorithmType >.

Definition at line 192 of file FCSOptimizeSolvingAlgorithm.h.

template<class SolvingAlgorithmType>
FCSStateSolvingReturnCodes FCSOptimizeSolvingAlgorithm< SolvingAlgorithmType >::Solve FCSStateWithLocations StateWithLocations,
int  Depth
[virtual]
 

Parameters:
StateWithLocations is the start state
Depth is the starting depth
Returns:
Solving return code

Reimplemented from FCSBFSSolvingAlgorithm< SolvingAlgorithmType >.

Definition at line 198 of file FCSOptimizeSolvingAlgorithm.h.

References FCSBFSSolvingAlgorithm< SolvingAlgorithmType >::BFSEnqueueState(), FCSStateWithLocations::GetFreecellCardNumber(), FCSStateWithLocations::GetStackLength(), FCSBFSSolvingAlgorithm< SolvingAlgorithmType >::m_BFSQueue, FCSBFSSolvingAlgorithm< SolvingAlgorithmType >::m_BFSQueueLastItem, FCSStateWithLocations::m_Depth, FCSBFSSolvingAlgorithm< SolvingAlgorithmType >::m_FirstStateToCheck, FCSStateWithLocations::m_MovesToParent, FCSStateWithLocationsLinkedList::m_Next, FCSDerivedStatesList::m_NumberOfStates, FCSStateWithLocations::m_Parent, FCSStateWithLocationsLinkedList::m_State, FCSDerivedStatesList::m_States, FCSStateWithLocations::m_Visited, and FCSStateWithLocations::m_VisitIterations.

Referenced by MainOptimize().


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