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

FCSTalonSolvingAlgorithm Class Reference

A algorithm class to solve solitare games with talons.

#include <FCSTalonSolvingAlgorithm.h>

Inheritance diagram for FCSTalonSolvingAlgorithm:

FCSFreecellSolvingAlgorithm FCSFreecellData FCSFreecellAlgorithm List of all members.

Public Member Functions

 FCSTalonSolvingAlgorithm (FCCommandLineArguments *CommandLine)
 Constructor with command line interface.
virtual ~FCSTalonSolvingAlgorithm ()
 Destructor.

Static Public Member Functions

static FCSTalonSolvingAlgorithmCreate (FCCommandLineArguments *CommandLine)
 Create a solving algorithm with CommandLine.

Protected Member Functions

 FCSTalonSolvingAlgorithm ()
 Default constructor.
void InitFCSTalonSolvingAlgorithm ()
 The "real" default constructor.
virtual void InitSolve (FCSStateWithLocations *InitState)
 Call this to initialize members needed for solve. (Common between all children).
virtual FCSStateSolvingReturnCodes CheckAndAddState (FCSStateWithLocations *NewState, FCSStateWithLocations **ExistingState, int Depth)
 If the state is new state (not generated before), add it to storage.
virtual FCSStateSolvingReturnCodes RunTest (int TestNumber, FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 Function to run each test on a state.
FCSStateSolvingReturnCodes GetCardFromKlondikeTalon (FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 This test moves a single cards from the talon to a stack.

Protected Attributes

FCSTalonType m_TalonType
 Type of talon used for the game.
FCInternalHash< FCSTalonStateData,
void > * 
m_TalonsHash
 The Klondike Talons' Cache in Hash storage.
CompareFunctionCompareNodesAlgorithm<
FCSTalonStateData, void > 
m_TalonCompareFunction
 The compare function used for the Klondike Talons' Cache.
MD5TalonStateDataHashAlgorithm m_TalonHashFunction
 The hash function used for the Klondike Talons' Cache.

Detailed Description

Definition at line 15 of file FCSTalonSolvingAlgorithm.h.


Member Function Documentation

FCSStateSolvingReturnCodes FCSTalonSolvingAlgorithm::CheckAndAddState FCSStateWithLocations NewState,
FCSStateWithLocations **  ExistingState,
int  Depth
[protected, virtual]
 

Parameters:
NewState is the state to add
ExistingState becomes the state to work with (if NewState is added, ExistingState = NewState)
Depth is the current depth of the state
Returns:
Solving return code

Reimplemented from FCSFreecellData.

Definition at line 114 of file FCSTalonSolvingAlgorithm.cpp.

References FCSStateWithLocations::CacheStacks(), FCSStateWithLocations::CanonizeState(), AFCSGenericStateStorage::CheckAndInsert(), FCSFreecellData::m_MaxDepth, FCSFreecellData::m_MaxNumberOfCheckedStates, FCSFreecellData::m_MaxNumberOfStatesInCollection, FCSFreecellData::m_NumberOfCheckedStates, FCSFreecellData::m_NumberOfFreecells, FCSFreecellData::m_NumberOfStacks, FCSFreecellData::m_NumberOfStatesInCollection, FCSFreecellData::m_StackStorage, FCSFreecellData::m_StateStorage, and m_TalonsHash.

FCSTalonSolvingAlgorithm * FCSTalonSolvingAlgorithm::Create FCCommandLineArguments CommandLine  )  [static]
 

It is assumed that CommandLine has already been verified. This includes a valid start state

Parameters:
CommandLine is the command line object with all the information to solve a freecell game
Returns:
A pointer to a talon solving algorithm.

Reimplemented from FCSFreecellSolvingAlgorithm.

Definition at line 43 of file FCSTalonSolvingAlgorithm.cpp.

References FCCommandLineArguments::GetSolvingMethodType().

Referenced by MainCreate().

FCSStateSolvingReturnCodes FCSTalonSolvingAlgorithm::GetCardFromKlondikeTalon FCSStateWithLocations StateWithLocations,
int  Depth,
int  NumberOfFreeStacks,
int  NumberOfFreecells,
FCSDerivedStatesList DerivedStateList
[protected]
 

Parameters:
StateWithLocations is the state to run the test on
Depth is the current depth of the state
NumberOfFreeStacks is the current number of free stacks in the state
NumberOfFreecells is the current number of freecells in the state
DerivedStateList is the current derived state list
Returns:
Solving return code

Definition at line 146 of file FCSTalonSolvingAlgorithm.cpp.

References FCSFreecellData::CheckStateBegin(), FCSFreecellData::CheckStateEnd(), FCSCard::Copy(), FCSTalonStateData::Copy(), FCSCard::Create(), FCSMove::Create(), CreateMoveStack(), CreateTalonStateData(), FCSCard::GetCardNumber(), FCSStateWithLocations::GetFoundation(), FCSTalonStateData::GetKlondikeNumberOfRedealsLeft(), FCSTalonStateData::GetKlondikeTalonLength(), FCSTalonStateData::GetKlondikeTalonQueuePosition(), FCSTalonStateData::GetKlondikeTalonStackPosition(), FCSTalonStateData::GetKlondikeTalonTopCard(), FCSStateWithLocations::GetStackCard(), FCSStateWithLocations::GetStackLength(), FCSCard::GetSuit(), FCSStateWithLocations::IncrementFoundation(), FCSCard::IsEmptyCard(), FCSFreecellData::IsParentCard(), FCSTalonStateData::KlondikeTalonQueueToStack(), FCSTalonStateData::KlondikeTalonRedealBare(), FCSFreecellData::m_EmptyStacksFill, FCSFreecellData::m_NumberOfDecks, FCSFreecellData::m_NumberOfStacks, m_TalonType, FCSMoveStack::Push(), FCSStateWithLocations::PushCardIntoStack(), FCSMove::SetDestStack(), FCSMove::SetFoundation(), FCSMove::SetNumberOfCardsFlipped(), and FCSMove::SetType().

Referenced by RunTest().

void FCSTalonSolvingAlgorithm::InitSolve FCSStateWithLocations InitState  )  [protected, virtual]
 

Parameters:
InitState is the start state of the game

Reimplemented from FCSFreecellData.

Definition at line 102 of file FCSTalonSolvingAlgorithm.cpp.

References FCSFreecellData::InitSolve(), m_TalonCompareFunction, m_TalonHashFunction, m_TalonsHash, m_TalonType, and TALON_CACHE_SIZE.

FCSStateSolvingReturnCodes FCSTalonSolvingAlgorithm::RunTest int  TestNumber,
FCSStateWithLocations StateWithLocations,
int  Depth,
int  NumberOfFreeStacks,
int  NumberOfFreecells,
FCSDerivedStatesList DerivedStateList
[protected, virtual]
 

Parameters:
TestNumber to be run
StateWithLocations is the state to run the test on
Depth is the current depth of the state
NumberOfFreeStacks is the current number of free stacks in the state
NumberOfFreecells is the current number of freecells in the state
DerivedStateList is the current derived state list
Returns:
Solving return code

Reimplemented from FCSFreecellSolvingAlgorithm.

Definition at line 69 of file FCSTalonSolvingAlgorithm.cpp.

References GetCardFromKlondikeTalon(), FCSFreecellSolvingAlgorithm::MoveCardsToADifferentParent(), FCSFreecellSolvingAlgorithm::MoveNonTopStackCardsToFounds(), FCSFreecellSolvingAlgorithm::MoveSequencesToFreeStacks(), FCSFreecellSolvingAlgorithm::MoveStackCardsToAParentOnTheSameStack(), FCSFreecellSolvingAlgorithm::MoveStackCardsToDifferentStacks(), and FCSFreecellSolvingAlgorithm::MoveTopStackCardsToFounds().


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