HOG2
Public Member Functions | Private Attributes | List of all members
FlipSide Class Reference

#include <FlipSide.h>

Inheritance diagram for FlipSide:
Inheritance graph
[legend]
Collaboration diagram for FlipSide:
Collaboration graph
[legend]

Public Member Functions

 FlipSide (int width=5)
 
 ~FlipSide ()
 
void GetSuccessors (const FlipSideState &stateID, std::vector< FlipSideState > &neighbors) const
 
void GetActions (const FlipSideState &stateID, std::vector< flipMove > &actions) const
 
flipMove GetAction (const FlipSideState &s1, const FlipSideState &s2) const
 
void ApplyAction (FlipSideState &s, flipMove a) const
 
bool InvertAction (flipMove &) const
 
double HCost (const FlipSideState &) const
 Heuristic value between node and the stored goal. More...
 
double HCost (const FlipSideState &state1, const FlipSideState &state2) const
 Heuristic value between two arbitrary nodes. More...
 
double GCost (const FlipSideState &state1, const FlipSideState &state2) const
 
double GCost (const FlipSideState &, const flipMove &) const
 
bool GoalTest (const FlipSideState &state, const FlipSideState &goal) const
 
bool GoalTest (const FlipSideState &) const
 Goal Test if the goal is stored. More...
 
uint64_t GetStateHash (const FlipSideState &state) const
 
uint64_t GetActionHash (flipMove act) const
 
void OpenGLDraw () const
 
void OpenGLDraw (const FlipSideState &s) const
 
void OpenGLDraw (const FlipSideState &, const flipMove &) const
 
void OpenGLDraw (const FlipSideState &, const FlipSideState &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
void StoreGoal (FlipSideState &)
 Stores the goal for use by single-state HCost. More...
 
void ClearGoal ()
 Clears the goal from memory. More...
 
bool IsGoalStored () const
 
- Public Member Functions inherited from SearchEnvironment< FlipSideState, flipMove >
virtual ~SearchEnvironment ()
 
virtual int GetNumSuccessors (const FlipSideState &stateID) const
 
virtual void UndoAction (FlipSideState &s, flipMove a) const
 
virtual void GetNextState (const FlipSideState &s1, flipMove a, FlipSideState &s2) const
 
virtual bool IsGoalStored () const
 Returns true if the goal is stored and false otherwise. More...
 
virtual double HCost (const FlipSideState &node1, const FlipSideState &node2, double parentHCost) const
 
virtual uint64_t GetMaxHash () const
 
virtual void GetStateFromHash (uint64_t parent, FlipSideState &s) const
 
virtual double GetPathLength (std::vector< FlipSideState > &neighbors)
 
virtual double GetPathLength (const FlipSideState &start, std::vector< flipMove > &neighbors)
 
virtual OccupancyInterface< FlipSideState, flipMove > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< FlipSideState, flipMove > *)
 
virtual void OpenGLDraw () const
 
virtual void GLLabelState (const FlipSideState &, const char *) const
 
virtual void GLDrawLine (const FlipSideState &x, const FlipSideState &y) const
 
virtual void GLDrawPath (const std::vector< FlipSideState > &x) const
 
virtual void SetColor (const rgbColor &r) const
 
virtual void SetColor (GLfloat rr, GLfloat g, GLfloat b, GLfloat t=1.0) const
 
virtual void GetColor (GLfloat &rr, GLfloat &g, GLfloat &b, GLfloat &t) const
 
virtual rgbColor GetColor () const
 
virtual void Draw (Graphics::Display &display) const
 
virtual void Draw (Graphics::Display &display, const FlipSideState &) const
 
virtual void DrawLine (Graphics::Display &display, const FlipSideState &x, const FlipSideState &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< FlipSideState >
 Heuristic ()
 
virtual ~Heuristic ()
 

Private Attributes

int width
 

Additional Inherited Members

- Public Attributes inherited from Heuristic< FlipSideState >
std::vector< HeuristicTreeNodelookups
 
std::vector< Heuristic * > heuristics
 
uint64_t histogram [256]
 
- Protected Attributes inherited from SearchEnvironment< FlipSideState, flipMove >
bool bValidSearchGoal
 
FlipSideState searchGoal
 
rgbColor color
 
GLfloat transparency
 

Detailed Description

Definition at line 66 of file FlipSide.h.

Constructor & Destructor Documentation

◆ FlipSide()

FlipSide::FlipSide ( int  width = 5)

Definition at line 12 of file FlipSide.cpp.

◆ ~FlipSide()

FlipSide::~FlipSide ( )

Definition at line 17 of file FlipSide.cpp.

Member Function Documentation

◆ ApplyAction()

void FlipSide::ApplyAction ( FlipSideState s,
flipMove  a 
) const
virtual

◆ ClearGoal()

void FlipSide::ClearGoal ( )
inlinevirtual

Clears the goal from memory.

Reimplemented from SearchEnvironment< FlipSideState, flipMove >.

Definition at line 98 of file FlipSide.h.

◆ GCost() [1/2]

double FlipSide::GCost ( const FlipSideState ,
const flipMove  
) const
inlinevirtual

Implements SearchEnvironment< FlipSideState, flipMove >.

Definition at line 83 of file FlipSide.h.

◆ GCost() [2/2]

double FlipSide::GCost ( const FlipSideState state1,
const FlipSideState state2 
) const
virtual

Implements SearchEnvironment< FlipSideState, flipMove >.

Definition at line 109 of file FlipSide.cpp.

◆ GetAction()

flipMove FlipSide::GetAction ( const FlipSideState s1,
const FlipSideState s2 
) const
virtual

Reimplemented from SearchEnvironment< FlipSideState, flipMove >.

Definition at line 46 of file FlipSide.cpp.

◆ GetActionHash()

uint64_t FlipSide::GetActionHash ( flipMove  act) const
virtual

Implements SearchEnvironment< FlipSideState, flipMove >.

Definition at line 129 of file FlipSide.cpp.

References flipMove::bottom, and flipMove::top.

◆ GetActions()

void FlipSide::GetActions ( const FlipSideState stateID,
std::vector< flipMove > &  actions 
) const
virtual

Implements SearchEnvironment< FlipSideState, flipMove >.

Definition at line 34 of file FlipSide.cpp.

References FlipSideState::width.

Referenced by GetSuccessors().

◆ GetStateHash()

uint64_t FlipSide::GetStateHash ( const FlipSideState state) const
virtual

Implements SearchEnvironment< FlipSideState, flipMove >.

Definition at line 119 of file FlipSide.cpp.

References FlipSideState::puzzle.

◆ GetSuccessors()

void FlipSide::GetSuccessors ( const FlipSideState stateID,
std::vector< FlipSideState > &  neighbors 
) const
virtual

Implements SearchEnvironment< FlipSideState, flipMove >.

Definition at line 21 of file FlipSide.cpp.

References ApplyAction(), and GetActions().

◆ GoalTest() [1/2]

bool FlipSide::GoalTest ( const FlipSideState node) const
inlinevirtual

Goal Test if the goal is stored.

Reimplemented from SearchEnvironment< FlipSideState, flipMove >.

Definition at line 86 of file FlipSide.h.

◆ GoalTest() [2/2]

bool FlipSide::GoalTest ( const FlipSideState state,
const FlipSideState goal 
) const
virtual

Implements SearchEnvironment< FlipSideState, flipMove >.

Definition at line 114 of file FlipSide.cpp.

◆ HCost() [1/2]

double FlipSide::HCost ( const FlipSideState node) const
inlinevirtual

Heuristic value between node and the stored goal.

Asserts that the goal is stored

Reimplemented from SearchEnvironment< FlipSideState, flipMove >.

Definition at line 78 of file FlipSide.h.

◆ HCost() [2/2]

double FlipSide::HCost ( const FlipSideState node1,
const FlipSideState node2 
) const
virtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< FlipSideState, flipMove >.

Definition at line 62 of file FlipSide.cpp.

References FlipSideState::puzzle, and FlipSideState::width.

◆ InvertAction()

bool FlipSide::InvertAction ( flipMove ) const
inlinevirtual

Implements SearchEnvironment< FlipSideState, flipMove >.

Definition at line 74 of file FlipSide.h.

◆ IsGoalStored()

bool FlipSide::IsGoalStored ( ) const
inline

Definition at line 99 of file FlipSide.h.

◆ OpenGLDraw() [1/4]

void FlipSide::OpenGLDraw ( ) const

Definition at line 134 of file FlipSide.cpp.

◆ OpenGLDraw() [2/4]

void FlipSide::OpenGLDraw ( const FlipSideState ,
const flipMove  
) const
inlinevirtual

Reimplemented from SearchEnvironment< FlipSideState, flipMove >.

Definition at line 94 of file FlipSide.h.

◆ OpenGLDraw() [3/4]

void FlipSide::OpenGLDraw ( const FlipSideState ,
const FlipSideState ,
float   
) const
inlinevirtual

Draw the transition at some percentage 0...1 between two states.

Reimplemented from SearchEnvironment< FlipSideState, flipMove >.

Definition at line 95 of file FlipSide.h.

◆ OpenGLDraw() [4/4]

void FlipSide::OpenGLDraw ( const FlipSideState s) const
virtual

Reimplemented from SearchEnvironment< FlipSideState, flipMove >.

Definition at line 139 of file FlipSide.cpp.

References width.

◆ StoreGoal()

void FlipSide::StoreGoal ( FlipSideState s)
inlinevirtual

Stores the goal for use by single-state HCost.

Reimplemented from SearchEnvironment< FlipSideState, flipMove >.

Definition at line 97 of file FlipSide.h.

Member Data Documentation

◆ width

int FlipSide::width
private

Definition at line 101 of file FlipSide.h.

Referenced by OpenGLDraw().


The documentation for this class was generated from the following files: