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

FCSSimpleSimonSolvingAlgorithm Class Reference

A algorithm class to solve simple simon games.

#include <FCSSimpleSimonSolvingAlgorithm.h>

Inheritance diagram for FCSSimpleSimonSolvingAlgorithm:

FCSFreecellData FCSFreecellAlgorithm List of all members.

Public Member Functions

virtual ~FCSSimpleSimonSolvingAlgorithm ()
 Destructor.

Static Public Member Functions

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

Protected Member Functions

 FCSSimpleSimonSolvingAlgorithm ()
 Default constructor.
 FCSSimpleSimonSolvingAlgorithm (FCCommandLineArguments *CommandLine)
 Constructor with command line interface.
virtual FCSStateSolvingReturnCodes RunTest (int TestNumber, FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 Function to run each test on a state.
bool IsSimpleSimonTrueParent (FCSCard *Parent, FCSCard *Child)
 Determines whether the above card is one greater in value than current card and is the same suit.
bool IsSimpleSimonTrueParentSuit (FCSCard *Parent, FCSCard *Child)
 Determines whether or not two cards have the same suit.
bool IsSimpleSimonFalseParent (FCSCard *Parent, FCSCard *Child)
 Determines whether the above card is one greater in value than current card.
FCSStateSolvingReturnCodes MoveSequenceToFounds (FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 This tests moves a suit of freecell cards to its foundation.
FCSStateSolvingReturnCodes MoveSequenceToTrueParent (FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 This tests moves a (group of) cards to its true parent (same suit).
FCSStateSolvingReturnCodes MoveWholeStackSequenceToFalseParent (FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 This tests moves a stack of cards to its false parent (different suit).
FCSStateSolvingReturnCodes MoveSequenceToTrueParentWithSomeCardsAbove (FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 This tests moves a (group of) cards to its true parent (same suit) when the parent isn't at the top of a stack.
FCSStateSolvingReturnCodes MoveSequenceWithSomeCardsAboveToTrueParent (FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 This tests moves a (group of) cards that have unsequenced cards above to its true parent (same suit).
FCSStateSolvingReturnCodes MoveSequenceWithJunkSequenceAboveToTrueParentWithSomeCardsAbove (FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 This tests moves a (group of) different suited cards to its true parent (same suit) when the parent isn't at the top of a stack.
FCSStateSolvingReturnCodes MoveWholeStackSequenceToFalseParentWithSomeCardsAbove (FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 This tests moves a (group of) cards to its false parent (different suit) when the parent isn't at the top of a stack.
FCSStateSolvingReturnCodes MoveSequenceToParentOnTheSameStack (FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 This tests moves a (group of) cards to its true parent (same suit) on the same stack.
FCSStateSolvingReturnCodes MoveSequenceToFalseParent (FCSStateWithLocations *StateWithLocations, int Depth, int NumberOfFreeStacks, int NumberOfFreecells, FCSDerivedStatesList *DerivedStateList)
 This tests moves a (group of) card(s) to its false parent (different suit).

Detailed Description

Definition at line 16 of file FCSSimpleSimonSolvingAlgorithm.h.


Member Function Documentation

FCSSimpleSimonSolvingAlgorithm * FCSSimpleSimonSolvingAlgorithm::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 freecell solving algorithm.

Definition at line 29 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCCommandLineArguments::GetSolvingMethodType().

Referenced by MainCreate().

bool FCSSimpleSimonSolvingAlgorithm::IsSimpleSimonFalseParent FCSCard Parent,
FCSCard Child
[inline, protected]
 

This was added for readability of the code

Parameters:
Parent is the card above
Child is the card below
Returns:
True if the above card is one greater in value

Definition at line 110 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSCard::GetCardNumber().

Referenced by IsSimpleSimonTrueParent(), MoveSequenceToFalseParent(), MoveSequenceToParentOnTheSameStack(), MoveSequenceToTrueParent(), MoveSequenceToTrueParentWithSomeCardsAbove(), MoveSequenceWithJunkSequenceAboveToTrueParentWithSomeCardsAbove(), MoveSequenceWithSomeCardsAboveToTrueParent(), MoveWholeStackSequenceToFalseParent(), and MoveWholeStackSequenceToFalseParentWithSomeCardsAbove().

bool FCSSimpleSimonSolvingAlgorithm::IsSimpleSimonTrueParent FCSCard Parent,
FCSCard Child
[inline, protected]
 

This was added for readability of the code

Parameters:
Parent is the card above
Child is the card below
Returns:
True if the above card is one greater in value and equal in suit

Definition at line 99 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References IsSimpleSimonFalseParent(), and IsSimpleSimonTrueParentSuit().

Referenced by MoveSequenceToFounds(), MoveSequenceToParentOnTheSameStack(), MoveSequenceToTrueParent(), MoveSequenceToTrueParentWithSomeCardsAbove(), MoveSequenceWithJunkSequenceAboveToTrueParentWithSomeCardsAbove(), and MoveSequenceWithSomeCardsAboveToTrueParent().

bool FCSSimpleSimonSolvingAlgorithm::IsSimpleSimonTrueParentSuit FCSCard Parent,
FCSCard Child
[inline, protected]
 

This was added for readability of the code

Parameters:
ParentSuit is the suit of the card above
ChildSuit is the suit of the card below
Returns:
True if the suits are equal, false otherwise

Definition at line 105 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSCard::GetSuit().

Referenced by IsSimpleSimonTrueParent(), MoveSequenceToFalseParent(), MoveSequenceToParentOnTheSameStack(), MoveSequenceToTrueParent(), MoveSequenceToTrueParentWithSomeCardsAbove(), MoveSequenceWithJunkSequenceAboveToTrueParentWithSomeCardsAbove(), MoveSequenceWithSomeCardsAboveToTrueParent(), MoveWholeStackSequenceToFalseParent(), and MoveWholeStackSequenceToFalseParentWithSomeCardsAbove().

FCSStateSolvingReturnCodes FCSSimpleSimonSolvingAlgorithm::MoveSequenceToFalseParent 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 1386 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSFreecellData::CalculateMaxSequenceMoves(), FCSFreecellData::CheckStateBegin(), FCSFreecellData::CheckStateEnd(), FCSCard::Create(), FCSMove::Create(), CreateMoveStack(), FCSStateWithLocations::GetStackCard(), FCSStateWithLocations::GetStackLength(), IsSimpleSimonFalseParent(), IsSimpleSimonTrueParentSuit(), FCSFreecellData::m_NumberOfStacks, and FCSFreecellData::MoveSequence().

Referenced by RunTest().

FCSStateSolvingReturnCodes FCSSimpleSimonSolvingAlgorithm::MoveSequenceToFounds 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 115 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSFreecellData::CheckStateBegin(), FCSFreecellData::CheckStateEnd(), FCSCard::Create(), FCSMove::Create(), CreateMoveStack(), FCSStateWithLocations::GetStackCard(), FCSStateWithLocations::GetStackLength(), FCSStateWithLocations::IncrementFoundation(), IsSimpleSimonTrueParent(), FCSFreecellData::m_NumberOfStacks, FCSStateWithLocations::PopStackCard(), FCSMoveStack::Push(), FCSMove::SetFoundation(), FCSMove::SetSourceStack(), and FCSMove::SetType().

Referenced by RunTest().

FCSStateSolvingReturnCodes FCSSimpleSimonSolvingAlgorithm::MoveSequenceToParentOnTheSameStack 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 1182 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSFreecellData::CalculateMaxSequenceMoves(), FCSFreecellData::CheckStateBegin(), FCSFreecellData::CheckStateEnd(), FCSCard::Create(), FCSMove::Create(), CreateMoveStack(), FCSStateWithLocations::GetStackCard(), FCSStateWithLocations::GetStackLength(), IsSimpleSimonFalseParent(), IsSimpleSimonTrueParent(), IsSimpleSimonTrueParentSuit(), FCSFreecellData::m_NumberOfStacks, and FCSFreecellData::MoveSequence().

Referenced by RunTest().

FCSStateSolvingReturnCodes FCSSimpleSimonSolvingAlgorithm::MoveSequenceToTrueParent 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 182 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSFreecellData::CalculateMaxSequenceMoves(), FCSFreecellData::CheckStateBegin(), FCSFreecellData::CheckStateEnd(), FCSCard::Create(), FCSMove::Create(), CreateMoveStack(), FCSStateWithLocations::GetStackCard(), FCSStateWithLocations::GetStackLength(), IsSimpleSimonFalseParent(), IsSimpleSimonTrueParent(), IsSimpleSimonTrueParentSuit(), FCSFreecellData::m_NumberOfStacks, and FCSFreecellData::MoveSequence().

Referenced by RunTest().

FCSStateSolvingReturnCodes FCSSimpleSimonSolvingAlgorithm::MoveSequenceToTrueParentWithSomeCardsAbove 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 347 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSFreecellData::CalculateMaxSequenceMoves(), FCSFreecellData::CheckStateBegin(), FCSFreecellData::CheckStateEnd(), FCSCard::Create(), FCSMove::Create(), CreateMoveStack(), FCSStateWithLocations::GetStackCard(), FCSStateWithLocations::GetStackLength(), FCSCard::GetSuit(), IsSimpleSimonFalseParent(), IsSimpleSimonTrueParent(), IsSimpleSimonTrueParentSuit(), FCSFreecellData::m_NumberOfStacks, and FCSFreecellData::MoveSequence().

Referenced by RunTest().

FCSStateSolvingReturnCodes FCSSimpleSimonSolvingAlgorithm::MoveSequenceWithJunkSequenceAboveToTrueParentWithSomeCardsAbove 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 749 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSFreecellData::CalculateMaxSequenceMoves(), FCSFreecellData::CheckStateBegin(), FCSFreecellData::CheckStateEnd(), FCSCard::Create(), FCSMove::Create(), CreateMoveStack(), FCSStateWithLocations::GetStackCard(), FCSStateWithLocations::GetStackLength(), IsSimpleSimonFalseParent(), IsSimpleSimonTrueParent(), IsSimpleSimonTrueParentSuit(), FCSFreecellData::m_NumberOfStacks, and FCSFreecellData::MoveSequence().

Referenced by RunTest().

FCSStateSolvingReturnCodes FCSSimpleSimonSolvingAlgorithm::MoveSequenceWithSomeCardsAboveToTrueParent 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 566 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSFreecellData::CalculateMaxSequenceMoves(), FCSFreecellData::CheckStateBegin(), FCSFreecellData::CheckStateEnd(), FCSCard::Create(), FCSMove::Create(), CreateMoveStack(), FCSStateWithLocations::GetStackCard(), FCSStateWithLocations::GetStackLength(), FCSCard::GetSuit(), IsSimpleSimonFalseParent(), IsSimpleSimonTrueParent(), IsSimpleSimonTrueParentSuit(), FCSFreecellData::m_NumberOfStacks, and FCSFreecellData::MoveSequence().

Referenced by RunTest().

FCSStateSolvingReturnCodes FCSSimpleSimonSolvingAlgorithm::MoveWholeStackSequenceToFalseParent 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 265 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSFreecellData::CalculateMaxSequenceMoves(), FCSFreecellData::CheckStateBegin(), FCSFreecellData::CheckStateEnd(), FCSCard::Create(), FCSMove::Create(), CreateMoveStack(), FCSStateWithLocations::GetStackCard(), FCSStateWithLocations::GetStackLength(), IsSimpleSimonFalseParent(), IsSimpleSimonTrueParentSuit(), FCSFreecellData::m_NumberOfStacks, and FCSFreecellData::MoveSequence().

Referenced by RunTest().

FCSStateSolvingReturnCodes FCSSimpleSimonSolvingAlgorithm::MoveWholeStackSequenceToFalseParentWithSomeCardsAbove 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 997 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References FCSFreecellData::CalculateMaxSequenceMoves(), FCSFreecellData::CheckStateBegin(), FCSFreecellData::CheckStateEnd(), FCSCard::Create(), FCSMove::Create(), CreateMoveStack(), FCSStateWithLocations::GetStackCard(), FCSStateWithLocations::GetStackLength(), IsSimpleSimonFalseParent(), IsSimpleSimonTrueParentSuit(), FCSFreecellData::m_NumberOfStacks, and FCSFreecellData::MoveSequence().

Referenced by RunTest().

FCSStateSolvingReturnCodes FCSSimpleSimonSolvingAlgorithm::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

Implements FCSFreecellAlgorithm.

Definition at line 60 of file FCSSimpleSimonSolvingAlgorithm.cpp.

References MoveSequenceToFalseParent(), MoveSequenceToFounds(), MoveSequenceToParentOnTheSameStack(), MoveSequenceToTrueParent(), MoveSequenceToTrueParentWithSomeCardsAbove(), MoveSequenceWithJunkSequenceAboveToTrueParentWithSomeCardsAbove(), MoveSequenceWithSomeCardsAboveToTrueParent(), MoveWholeStackSequenceToFalseParent(), and MoveWholeStackSequenceToFalseParentWithSomeCardsAbove().


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