HOG2
|
#include <Hexagon.h>
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< rgbColor > | pieceColors |
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< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Protected Attributes inherited from SearchEnvironment< HexagonState, HexagonAction > | |
bool | bValidSearchGoal |
HexagonState | searchGoal |
rgbColor | color |
GLfloat | transparency |
Hexagon::Hexagon | ( | ) |
Definition at line 1030 of file Hexagon.cpp.
Hexagon::~Hexagon | ( | ) |
Definition at line 1034 of file Hexagon.cpp.
|
virtual |
Implements SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1183 of file Hexagon.cpp.
|
virtual |
Reimplemented from SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1388 of file Hexagon.cpp.
References Colors::black, Colors::darkgray, diagPieces, Graphics::Display::DrawText(), Graphics::Display::FillRect(), Graphics::Display::FillTriangle(), Graphics::Display::FrameTriangle(), GetCorners(), Colors::lightgray, noFlipPieces, notTouchPieces, pieceColors, Graphics::textAlignLeft, Graphics::textBaselineMiddle, touchPieces, Valid(), and Colors::white.
|
virtual |
Reimplemented from SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1538 of file Hexagon.cpp.
References Colors::black, Graphics::Display::DrawLine(), Graphics::Display::FillTriangle(), NBitArray< numBits >::Get(), GetBorder(), GetCorners(), pieceColors, HexagonState::state, and Valid().
void Hexagon::DrawSetup | ( | Graphics::Display & | display | ) | const |
Draws available pieces and constraints.
Definition at line 1434 of file Hexagon.cpp.
References Colors::black, Graphics::rect::bottom, diagPieces, Graphics::Display::DrawText(), Graphics::Display::FillRect(), Graphics::Display::FillTriangle(), NBitArray< numBits >::Get(), GetCorners(), Graphics::rect::left, max, noFlipPieces, notTouchPieces, pieceColors, Graphics::rect::right, solution, HexagonState::state, Graphics::textAlignLeft, Graphics::textBaselineMiddle, Graphics::rect::top, touchPieces, Valid(), Colors::white, Graphics::point::x, and Graphics::point::y.
Referenced by HexagonEnvironment::DrawSetup().
|
inlinevirtual |
Implements SearchEnvironment< HexagonState, HexagonAction >.
|
inlinevirtual |
Implements SearchEnvironment< HexagonState, HexagonAction >.
|
virtual |
Reimplemented from SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1177 of file Hexagon.cpp.
|
virtual |
Implements SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1204 of file Hexagon.cpp.
|
virtual |
Implements SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1172 of file Hexagon.cpp.
|
private |
Definition at line 1221 of file Hexagon.cpp.
Referenced by Draw(), and HexagonEnvironment::GetBorder().
|
private |
Definition at line 1336 of file Hexagon.cpp.
Referenced by Draw(), DrawSetup(), and HexagonEnvironment::GetCorners().
|
virtual |
Reimplemented from SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1188 of file Hexagon.cpp.
|
virtual |
Implements SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1199 of file Hexagon.cpp.
|
virtual |
Implements SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1167 of file Hexagon.cpp.
|
virtual |
Goal Test if the goal is stored.
Reimplemented from SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1210 of file Hexagon.cpp.
Referenced by GoalTest().
|
inlinevirtual |
Implements SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 108 of file Hexagon.h.
References GoalTest().
|
inlinevirtual |
Heuristic value between two arbitrary nodes.
Implements SearchEnvironment< HexagonState, HexagonAction >.
|
virtual |
Implements SearchEnvironment< HexagonState, HexagonAction >.
Definition at line 1193 of file Hexagon.cpp.
|
private |
Definition at line 1049 of file Hexagon.cpp.
References diagPieces, NBitArray< numBits >::FillMax(), rgbColor::hsl(), noFlipPieces, notTouchPieces, pieceColors, NBitArray< numBits >::Set(), solution, HexagonState::state, touchPieces, and Valid().
Referenced by LoadPuzzle(), and LoadSolution().
void Hexagon::LoadPuzzle | ( | const char * | file, |
HexagonState & | s | ||
) |
Definition at line 1044 of file Hexagon.cpp.
References Load().
void Hexagon::LoadSolution | ( | const char * | file, |
HexagonState & | s | ||
) |
Definition at line 1039 of file Hexagon.cpp.
References Load().
void Hexagon::RotateCW | ( | HexagonState & | s | ) | const |
Definition at line 1215 of file Hexagon.cpp.
|
private |
Definition at line 1374 of file Hexagon.cpp.
Referenced by Draw(), DrawSetup(), Load(), and HexagonEnvironment::Valid().
|
private |
Definition at line 126 of file Hexagon.h.
Referenced by Draw(), DrawSetup(), and Load().
|
private |
Definition at line 127 of file Hexagon.h.
Referenced by Draw(), DrawSetup(), and Load().
|
private |
Definition at line 128 of file Hexagon.h.
Referenced by Draw(), DrawSetup(), and Load().
|
private |
Definition at line 125 of file Hexagon.h.
Referenced by Draw(), DrawSetup(), and Load().
|
private |
Definition at line 124 of file Hexagon.h.
Referenced by DrawSetup(), and Load().
|
private |
Definition at line 129 of file Hexagon.h.
Referenced by Draw(), DrawSetup(), and Load().