HOG2
|
#include <Hexagon.h>
Public Member Functions | |
HexagonEnvironment () | |
~HexagonEnvironment () | |
void | SetPieces (const std::vector< tPieceName > &pieces) |
void | SetFlippable (const std::array< tFlipType, numPieces > &flips) |
void | GetSuccessors (const HexagonSearchState &nodeID, std::vector< HexagonSearchState > &neighbors) const |
void | GetActions (const HexagonSearchState &nodeID, std::vector< HexagonAction > &actions) const |
HexagonAction | GetAction (const HexagonSearchState &s1, const HexagonSearchState &s2) const |
void | ApplyAction (HexagonSearchState &s, HexagonAction a) const |
void | UndoAction (HexagonSearchState &s, HexagonAction a) const |
void | GetNextState (const HexagonSearchState &, HexagonAction, HexagonSearchState &) const |
bool | InvertAction (HexagonAction &a) const |
void | RotateCW (HexagonSearchState &s) const |
HexagonAction | RotateCW (HexagonAction a) const |
void | Flip (HexagonSearchState &s) const |
HexagonAction | Flip (HexagonAction a) const |
bool | GoalTest (const HexagonSearchState &node) const |
Goal Test if the goal is stored. More... | |
double | HCost (const HexagonSearchState &node1, const HexagonSearchState &node2) const |
Heuristic value between two arbitrary nodes. More... | |
double | GCost (const HexagonSearchState &node1, const HexagonSearchState &node2) const |
double | GCost (const HexagonSearchState &node, const HexagonAction &act) const |
bool | GoalTest (const HexagonSearchState &node, const HexagonSearchState &goal) const |
uint64_t | GetStateHash (const HexagonSearchState &node) const |
uint64_t | GetActionHash (HexagonAction act) const |
void | GeneratePieceCoordinates (tPieceName p) |
Prints out the triangles used for this piece in HOG2 coordinates. More... | |
void | GenerateBoardBorder () |
Prints out the outer coorsinates of the board. More... | |
void | Draw (Graphics::Display &display) const |
void | DrawSetup (Graphics::Display &display) const |
Draws available pieces and constraints. More... | |
void | Draw (Graphics::Display &display, const HexagonSearchState &) const |
Public Member Functions inherited from SearchEnvironment< HexagonSearchState, HexagonAction > | |
virtual | ~SearchEnvironment () |
virtual int | GetNumSuccessors (const HexagonSearchState &stateID) const |
virtual void | StoreGoal (HexagonSearchState &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 HexagonSearchState &node1, const HexagonSearchState &node2, double parentHCost) const |
virtual double | HCost (const HexagonSearchState &node) const |
Heuristic value between node and the stored goal. More... | |
virtual uint64_t | GetMaxHash () const |
virtual void | GetStateFromHash (uint64_t parent, HexagonSearchState &s) const |
virtual double | GetPathLength (std::vector< HexagonSearchState > &neighbors) |
virtual double | GetPathLength (const HexagonSearchState &start, std::vector< HexagonAction > &neighbors) |
virtual OccupancyInterface< HexagonSearchState, HexagonAction > * | GetOccupancyInfo () |
virtual void | SetOccupancyInfo (OccupancyInterface< HexagonSearchState, HexagonAction > *) |
virtual void | OpenGLDraw () const |
virtual void | OpenGLDraw (const HexagonSearchState &) const |
virtual void | OpenGLDraw (const HexagonSearchState &, const HexagonSearchState &, float) const |
Draw the transition at some percentage 0...1 between two states. More... | |
virtual void | OpenGLDraw (const HexagonSearchState &, const HexagonAction &) const |
virtual void | GLLabelState (const HexagonSearchState &, const char *) const |
virtual void | GLDrawLine (const HexagonSearchState &x, const HexagonSearchState &y) const |
virtual void | GLDrawPath (const std::vector< HexagonSearchState > &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 HexagonSearchState &x, const HexagonSearchState &y, float width=1.0) const |
Public Member Functions inherited from Heuristic< HexagonSearchState > | |
Heuristic () | |
virtual | ~Heuristic () |
Private Member Functions | |
void | BuildRotationTable () |
void | BuildFlipTable () |
void | IndexToXY (int index, int &x, int &y) const |
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 | |
std::vector< rgbColor > | pieceColors |
std::vector< int > | pieces |
std::array< tFlipType, numPieces > | flippable |
Hexagon | hex |
int | rotate30Map [numPieces][14 *6 *2+1] |
int | flipMap [numPieces][14 *6 *2+1] |
Additional Inherited Members | |
Public Attributes inherited from Heuristic< HexagonSearchState > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Protected Attributes inherited from SearchEnvironment< HexagonSearchState, HexagonAction > | |
bool | bValidSearchGoal |
HexagonSearchState | searchGoal |
rgbColor | color |
GLfloat | transparency |
HexagonEnvironment::HexagonEnvironment | ( | ) |
Definition at line 570 of file Hexagon.cpp.
References BuildFlipTable(), BuildRotationTable(), flippable, kButterfly, kCanFlip, kElbow, kHexagon, kHook, kMountains, kSide1, kSnake, kTrapezoid, kTriangle, kWrench, and pieces.
HexagonEnvironment::~HexagonEnvironment | ( | ) |
Definition at line 597 of file Hexagon.cpp.
|
virtual |
Implements SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 774 of file Hexagon.cpp.
References HexagonSearchState::bits, HexagonSearchState::cnt, HexagonAction::location, locations, HexagonAction::piece, and HexagonSearchState::state.
Referenced by Draw(), Flip(), GetNextState(), and RotateCW().
|
private |
Definition at line 641 of file Hexagon.cpp.
References flipMap, flipTable, locations, and numPieces.
Referenced by HexagonEnvironment().
|
private |
Definition at line 602 of file Hexagon.cpp.
References locations, numPieces, rotate30Map, and rotateCWTable.
Referenced by HexagonEnvironment().
|
virtual |
Reimplemented from SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 895 of file Hexagon.cpp.
|
virtual |
Reimplemented from SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 906 of file Hexagon.cpp.
References ApplyAction(), HexagonSearchState::bits, HexagonSearchState::cnt, Graphics::Display::FillSquare(), Graphics::Display::FillTriangle(), GetCorners(), rgbColor::hsl(), IndexToXY(), Colors::lightgray, HexagonSearchState::Reset(), HexagonSearchState::state, and Colors::white.
void HexagonEnvironment::DrawSetup | ( | Graphics::Display & | display | ) | const |
Draws available pieces and constraints.
Definition at line 901 of file Hexagon.cpp.
References Hexagon::DrawSetup(), and hex.
HexagonAction HexagonEnvironment::Flip | ( | HexagonAction | a | ) | const |
Definition at line 706 of file Hexagon.cpp.
References flipMap, HexagonAction::location, and HexagonAction::piece.
void HexagonEnvironment::Flip | ( | HexagonSearchState & | s | ) | const |
Definition at line 696 of file Hexagon.cpp.
References ApplyAction(), HexagonSearchState::cnt, and HexagonSearchState::state.
|
inlinevirtual |
|
inlinevirtual |
void HexagonEnvironment::GenerateBoardBorder | ( | ) |
Prints out the outer coorsinates of the board.
Definition at line 870 of file Hexagon.cpp.
References GetCorners(), and IndexToXY().
void HexagonEnvironment::GeneratePieceCoordinates | ( | tPieceName | p | ) |
Prints out the triangles used for this piece in HOG2 coordinates.
Definition at line 819 of file Hexagon.cpp.
References HexagonSearchState::bits, HexagonSearchState::cnt, GetCorners(), GetSuccessors(), IndexToXY(), pieceNames, and SetPieces().
|
virtual |
Reimplemented from SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 768 of file Hexagon.cpp.
|
virtual |
Implements SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 813 of file Hexagon.cpp.
|
virtual |
Implements SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 725 of file Hexagon.cpp.
References HexagonSearchState::bits, HexagonSearchState::cnt, flippable, kCanFlip, kSide1, kSide2, locations, noFlipMoveCount, and pieces.
Referenced by GetSuccessors().
|
private |
Definition at line 1013 of file Hexagon.cpp.
References Hexagon::GetBorder(), and hex.
|
private |
Definition at line 1008 of file Hexagon.cpp.
References Hexagon::GetCorners(), and hex.
Referenced by Draw(), GenerateBoardBorder(), and GeneratePieceCoordinates().
|
virtual |
Reimplemented from SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 788 of file Hexagon.cpp.
References ApplyAction().
Referenced by GetSuccessors().
|
virtual |
Implements SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 808 of file Hexagon.cpp.
|
virtual |
Implements SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 712 of file Hexagon.cpp.
References GetActions(), and GetNextState().
Referenced by GeneratePieceCoordinates().
|
virtual |
Goal Test if the goal is stored.
Reimplemented from SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 801 of file Hexagon.cpp.
Referenced by GoalTest().
|
inlinevirtual |
Implements SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 204 of file Hexagon.h.
References GoalTest().
|
inlinevirtual |
Heuristic value between two arbitrary nodes.
Implements SearchEnvironment< HexagonSearchState, HexagonAction >.
|
private |
Definition at line 940 of file Hexagon.cpp.
Referenced by Draw(), GenerateBoardBorder(), and GeneratePieceCoordinates().
|
virtual |
Implements SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 795 of file Hexagon.cpp.
HexagonAction HexagonEnvironment::RotateCW | ( | HexagonAction | a | ) | const |
Definition at line 690 of file Hexagon.cpp.
References HexagonAction::location, HexagonAction::piece, and rotate30Map.
void HexagonEnvironment::RotateCW | ( | HexagonSearchState & | s | ) | const |
Definition at line 680 of file Hexagon.cpp.
References ApplyAction(), HexagonSearchState::cnt, and HexagonSearchState::state.
Definition at line 591 of file Hexagon.cpp.
References flippable.
void HexagonEnvironment::SetPieces | ( | const std::vector< tPieceName > & | pieces | ) |
Definition at line 584 of file Hexagon.cpp.
References pieces.
Referenced by GeneratePieceCoordinates().
|
virtual |
Reimplemented from SearchEnvironment< HexagonSearchState, HexagonAction >.
Definition at line 781 of file Hexagon.cpp.
References HexagonSearchState::bits, HexagonSearchState::cnt, HexagonAction::location, locations, and HexagonAction::piece.
|
private |
Definition at line 1018 of file Hexagon.cpp.
References hex, and Hexagon::Valid().
|
private |
Definition at line 231 of file Hexagon.h.
Referenced by BuildFlipTable(), and Flip().
Definition at line 228 of file Hexagon.h.
Referenced by GetActions(), HexagonEnvironment(), and SetFlippable().
|
private |
Definition at line 229 of file Hexagon.h.
Referenced by DrawSetup(), GetBorder(), GetCorners(), and Valid().
|
private |
|
private |
Definition at line 227 of file Hexagon.h.
Referenced by GetActions(), HexagonEnvironment(), and SetPieces().
|
private |
Definition at line 230 of file Hexagon.h.
Referenced by BuildRotationTable(), and RotateCW().