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

#include <Hexagon.h>

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

Public Member Functions

 Hexagon ()
 
 ~Hexagon ()
 
void LoadPuzzle (const char *, HexagonState &s)
 
void LoadSolution (const char *, HexagonState &s)
 
void GetSuccessors (const HexagonState &nodeID, std::vector< HexagonState > &neighbors) const
 
void GetActions (const HexagonState &nodeID, std::vector< HexagonAction > &actions) const
 
HexagonAction GetAction (const HexagonState &s1, const HexagonState &s2) const
 
void ApplyAction (HexagonState &s, HexagonAction a) const
 
void GetNextState (const HexagonState &, HexagonAction, HexagonState &) const
 
bool InvertAction (HexagonAction &a) const
 
void RotateCW (HexagonState &s) const
 
bool GoalTest (const HexagonState &node) const
 Goal Test if the goal is stored. More...
 
double HCost (const HexagonState &node1, const HexagonState &node2) const
 Heuristic value between two arbitrary nodes. More...
 
double GCost (const HexagonState &node1, const HexagonState &node2) const
 
double GCost (const HexagonState &node, const HexagonAction &act) const
 
bool GoalTest (const HexagonState &node, const HexagonState &goal) const
 
uint64_t GetStateHash (const HexagonState &node) const
 
uint64_t GetActionHash (HexagonAction act) const
 
void Draw (Graphics::Display &display) const
 
void DrawSetup (Graphics::Display &display) const
 Draws available pieces and constraints. More...
 
void Draw (Graphics::Display &display, const HexagonState &) const
 
- Public Member Functions inherited from SearchEnvironment< HexagonState, HexagonAction >
virtual ~SearchEnvironment ()
 
virtual int GetNumSuccessors (const HexagonState &stateID) const
 
virtual void UndoAction (HexagonState &s, HexagonAction a) const
 
virtual void StoreGoal (HexagonState &s)
 Stores the goal for use by single-state HCost. More...
 
virtual void ClearGoal ()
 Clears the goal from memory. More...
 
virtual bool IsGoalStored () const
 Returns true if the goal is stored and false otherwise. More...
 
virtual double HCost (const HexagonState &node1, const HexagonState &node2, double parentHCost) const
 
virtual double HCost (const HexagonState &node) const
 Heuristic value between node and the stored goal. More...
 
virtual uint64_t GetMaxHash () const
 
virtual void GetStateFromHash (uint64_t parent, HexagonState &s) const
 
virtual double GetPathLength (std::vector< HexagonState > &neighbors)
 
virtual double GetPathLength (const HexagonState &start, std::vector< HexagonAction > &neighbors)
 
virtual OccupancyInterface< HexagonState, HexagonAction > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< HexagonState, HexagonAction > *)
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const HexagonState &) const
 
virtual void OpenGLDraw (const HexagonState &, const HexagonState &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void OpenGLDraw (const HexagonState &, const HexagonAction &) const
 
virtual void GLLabelState (const HexagonState &, const char *) const
 
virtual void GLDrawLine (const HexagonState &x, const HexagonState &y) const
 
virtual void GLDrawPath (const std::vector< HexagonState > &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 DrawLine (Graphics::Display &display, const HexagonState &x, const HexagonState &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< HexagonState >
 Heuristic ()
 
virtual ~Heuristic ()
 

Private Member Functions

void Load (const char *, HexagonState &s, bool solution)
 
void GetCorners (int x, int y, Graphics::point &p1, Graphics::point &p2, Graphics::point &p3) const
 
bool GetBorder (int x, int y, int xoff, int yoff, Graphics::point &p1, Graphics::point &p2) const
 
bool Valid (int x, int y) const
 

Private Attributes

friend HexagonEnvironment
 
HexagonState solution
 
std::vector< rgbColorpieceColors
 
std::vector< int > diagPieces
 
std::vector< int > noFlipPieces
 
std::vector< int > notTouchPieces
 
std::vector< int > touchPieces
 

Additional Inherited Members

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

Detailed Description

Definition at line 84 of file Hexagon.h.

Constructor & Destructor Documentation

◆ Hexagon()

Hexagon::Hexagon ( )

Definition at line 1030 of file Hexagon.cpp.

◆ ~Hexagon()

Hexagon::~Hexagon ( )

Definition at line 1034 of file Hexagon.cpp.

Member Function Documentation

◆ ApplyAction()

void Hexagon::ApplyAction ( HexagonState s,
HexagonAction  a 
) const
virtual

Implements SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 1183 of file Hexagon.cpp.

◆ Draw() [1/2]

void Hexagon::Draw ( Graphics::Display display) const
virtual

◆ Draw() [2/2]

void Hexagon::Draw ( Graphics::Display display,
const HexagonState s 
) const
virtual

◆ DrawSetup()

void Hexagon::DrawSetup ( Graphics::Display display) const

◆ GCost() [1/2]

double Hexagon::GCost ( const HexagonState node,
const HexagonAction act 
) const
inlinevirtual

Implements SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 107 of file Hexagon.h.

◆ GCost() [2/2]

double Hexagon::GCost ( const HexagonState node1,
const HexagonState node2 
) const
inlinevirtual

Implements SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 106 of file Hexagon.h.

◆ GetAction()

HexagonAction Hexagon::GetAction ( const HexagonState s1,
const HexagonState s2 
) const
virtual

Reimplemented from SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 1177 of file Hexagon.cpp.

◆ GetActionHash()

uint64_t Hexagon::GetActionHash ( HexagonAction  act) const
virtual

Implements SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 1204 of file Hexagon.cpp.

◆ GetActions()

void Hexagon::GetActions ( const HexagonState nodeID,
std::vector< HexagonAction > &  actions 
) const
virtual

Implements SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 1172 of file Hexagon.cpp.

◆ GetBorder()

bool Hexagon::GetBorder ( int  x,
int  y,
int  xoff,
int  yoff,
Graphics::point p1,
Graphics::point p2 
) const
private

Definition at line 1221 of file Hexagon.cpp.

Referenced by Draw(), and HexagonEnvironment::GetBorder().

◆ GetCorners()

void Hexagon::GetCorners ( int  x,
int  y,
Graphics::point p1,
Graphics::point p2,
Graphics::point p3 
) const
private

Definition at line 1336 of file Hexagon.cpp.

Referenced by Draw(), DrawSetup(), and HexagonEnvironment::GetCorners().

◆ GetNextState()

void Hexagon::GetNextState ( const HexagonState ,
HexagonAction  ,
HexagonState  
) const
virtual

Reimplemented from SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 1188 of file Hexagon.cpp.

◆ GetStateHash()

uint64_t Hexagon::GetStateHash ( const HexagonState node) const
virtual

Implements SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 1199 of file Hexagon.cpp.

◆ GetSuccessors()

void Hexagon::GetSuccessors ( const HexagonState nodeID,
std::vector< HexagonState > &  neighbors 
) const
virtual

Implements SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 1167 of file Hexagon.cpp.

◆ GoalTest() [1/2]

bool Hexagon::GoalTest ( const HexagonState node) const
virtual

Goal Test if the goal is stored.

Reimplemented from SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 1210 of file Hexagon.cpp.

Referenced by GoalTest().

◆ GoalTest() [2/2]

bool Hexagon::GoalTest ( const HexagonState node,
const HexagonState goal 
) const
inlinevirtual

Implements SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 108 of file Hexagon.h.

References GoalTest().

◆ HCost()

double Hexagon::HCost ( const HexagonState node1,
const HexagonState node2 
) const
inlinevirtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 105 of file Hexagon.h.

◆ InvertAction()

bool Hexagon::InvertAction ( HexagonAction a) const
virtual

Implements SearchEnvironment< HexagonState, HexagonAction >.

Definition at line 1193 of file Hexagon.cpp.

◆ Load()

void Hexagon::Load ( const char *  file,
HexagonState s,
bool  solution 
)
private

◆ LoadPuzzle()

void Hexagon::LoadPuzzle ( const char *  file,
HexagonState s 
)

Definition at line 1044 of file Hexagon.cpp.

References Load().

◆ LoadSolution()

void Hexagon::LoadSolution ( const char *  file,
HexagonState s 
)

Definition at line 1039 of file Hexagon.cpp.

References Load().

◆ RotateCW()

void Hexagon::RotateCW ( HexagonState s) const

Definition at line 1215 of file Hexagon.cpp.

◆ Valid()

bool Hexagon::Valid ( int  x,
int  y 
) const
private

Definition at line 1374 of file Hexagon.cpp.

Referenced by Draw(), DrawSetup(), Load(), and HexagonEnvironment::Valid().

Member Data Documentation

◆ diagPieces

std::vector<int> Hexagon::diagPieces
private

Definition at line 126 of file Hexagon.h.

Referenced by Draw(), DrawSetup(), and Load().

◆ HexagonEnvironment

friend Hexagon::HexagonEnvironment
private

Definition at line 119 of file Hexagon.h.

◆ noFlipPieces

std::vector<int> Hexagon::noFlipPieces
private

Definition at line 127 of file Hexagon.h.

Referenced by Draw(), DrawSetup(), and Load().

◆ notTouchPieces

std::vector<int> Hexagon::notTouchPieces
private

Definition at line 128 of file Hexagon.h.

Referenced by Draw(), DrawSetup(), and Load().

◆ pieceColors

std::vector<rgbColor> Hexagon::pieceColors
private

Definition at line 125 of file Hexagon.h.

Referenced by Draw(), DrawSetup(), and Load().

◆ solution

HexagonState Hexagon::solution
private

Definition at line 124 of file Hexagon.h.

Referenced by DrawSetup(), and Load().

◆ touchPieces

std::vector<int> Hexagon::touchPieces
private

Definition at line 129 of file Hexagon.h.

Referenced by Draw(), DrawSetup(), and Load().


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