HOG2
|
#include <RC.h>
Public Member Functions | |
void | DrawCubies (Graphics::Display &display) const |
void | DrawCubiesRotating (Graphics::Display &display) const |
void | RotateCubies (float add[3]) |
void | RotateFace (int face, int move) |
void | InterpFaceRot (float progress) |
void | TestUpdate () |
RC () | |
std::string | GetName () |
void | SetPruneSuccessors (bool val) |
void | GetSuccessors (const RCState &nodeID, std::vector< RCState > &neighbors) const |
void | GetActions (const RCState &nodeID, std::vector< RCAction > &actions) const |
void | GetPrunedActions (const RCState &nodeID, RCAction lastAction, std::vector< RCAction > &actions) const |
RCAction | GetAction (const RCState &s1, const RCState &s2) const |
void | ApplyAction (RCState &s, RCAction a) const |
void | UndoAction (RCState &s, RCAction a) const |
void | GetNextState (const RCState &, RCAction, RCState &) const |
bool | InvertAction (RCAction &a) const |
double | HCost (const RCState &node1, const RCState &node2) const |
Heuristic value between two arbitrary nodes. More... | |
double | HCost (const RCState &node1, const RCState &node2, double parentHCost) const |
int | Edge12PDBDist (const RCState &s) |
double | HCost (const RCState &node) const |
Heuristic value between node and the stored goal. More... | |
double | GCost (const RCState &node1, const RCState &node2) const |
double | GCost (const RCState &node, const RCAction &act) const |
bool | GoalTest (const RCState &node, const RCState &goal) const |
bool | GoalTest (const RCState &node) const |
Goal Test if the goal is stored. More... | |
uint64_t | GetStateHash (const RCState &node) const |
uint64_t | GetActionHash (RCAction act) const |
void | GetStateFromHash (uint64_t hash, RCState &node) const |
void | OpenGLDraw () const |
void | OpenGLDraw (const RCState &) const |
void | OpenGLDrawCorners (const RCState &) const |
void | OpenGLDrawEdges (const RCState &) const |
void | OpenGLDrawEdgeDual (const RCState &) const |
void | OpenGLDrawCenters () const |
void | OpenGLDrawCubeBackground () const |
void | OpenGLDraw (const RCState &, const RCState &, float) const |
Draw the transition at some percentage 0...1 between two states. More... | |
void | OpenGLDraw (const RCState &, const RCAction &) const |
void | Draw (Graphics::Display &display, const RCState &) const |
void | OpenGLDrawCube (int cube) const |
void | SetFaceColor (int face) const |
uint64_t | GetPDBSizeCorner () const |
uint64_t | GetPDBHashCorner (const RCState &s, int threadID) const |
void | GetStateFromPDBHashCorner (uint64_t hash, RCState &s, int threadID) const |
uint64_t | GetStateHashCorner (const RCState &s) |
uint64_t | FactorialUpperK (int n, int k) const |
Public Member Functions inherited from SearchEnvironment< RCState, RCAction > | |
virtual | ~SearchEnvironment () |
virtual int | GetNumSuccessors (const RCState &stateID) const |
virtual void | StoreGoal (RCState &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 uint64_t | GetMaxHash () const |
virtual double | GetPathLength (std::vector< RCState > &neighbors) |
virtual double | GetPathLength (const RCState &start, std::vector< RCAction > &neighbors) |
virtual OccupancyInterface< RCState, RCAction > * | GetOccupancyInfo () |
virtual void | SetOccupancyInfo (OccupancyInterface< RCState, RCAction > *) |
virtual void | OpenGLDraw () const |
virtual void | GLLabelState (const RCState &, const char *) const |
virtual void | GLDrawLine (const RCState &x, const RCState &y) const |
virtual void | GLDrawPath (const std::vector< RCState > &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 | DrawLine (Graphics::Display &display, const RCState &x, const RCState &y, float width=1.0) const |
Public Member Functions inherited from Heuristic< RCState > | |
Heuristic () | |
virtual | ~Heuristic () |
Public Attributes | |
std::vector< int > | corners |
std::vector< int > | edges |
const int | fromFaceToCenter [6] |
const int | faceBlackUnderside [6] |
const float | piOver2 = 1.57079632679 |
const float | turnSpd = 0.04 |
const int | edgeOrder [4] = {1, 5, 7, 3} |
const int | cornerOrder [4] = {0, 2, 8, 6} |
const int | convertStatePos [20] |
Cubie | cubies [26] |
float | rotationTotal [3] |
int | cubiesOnFace [6][9] |
int | cubieInPos [26] |
int | faceTurning |
int | notInFaceTurning [6][17] |
bool | rotating = false |
bool | rotatingFaceBehind = false |
float | rotProgress = 0 |
float | turnArr [3] |
float | interpArr [3] |
bool | passiveRot = true |
std::vector< RCAction > | history |
bool | pruneSuccessors |
Public Attributes inherited from Heuristic< RCState > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Additional Inherited Members | |
Protected Attributes inherited from SearchEnvironment< RCState, RCAction > | |
bool | bValidSearchGoal |
RCState | searchGoal |
rgbColor | color |
GLfloat | transparency |
|
inline |
Definition at line 312 of file RC.h.
References corners, cubieInPos, cubies, cubiesOnFace, edges, Cubie::Initialize(), notInFaceTurning, pruneSuccessors, and rotationTotal.
Implements SearchEnvironment< RCState, RCAction >.
Definition at line 1282 of file RC.cpp.
References history, pruneSuccessors, and RCState::RotateFace().
Referenced by RubiksCubeInstances::GetKorfRubikInstance(), GetNextState(), RubiksCubeInstances::GetRandomN(), and RubiksCubeInstances::GetSuperFlip().
|
virtual |
Reimplemented from SearchEnvironment< RCState, RCAction >.
Definition at line 1408 of file RC.cpp.
References convertStatePos, cubies, DrawCubies(), RCState::indices, Cubie::Initialize(), Cubie::ResetToBase(), Cubie::RotateRelative(), RCState::rotation, and rotationTotal.
Referenced by DrawCubiesRotating().
void RC::DrawCubies | ( | Graphics::Display & | display | ) | const |
Definition at line 964 of file RC.cpp.
References cubies, Cubie::Draw(), DrawCubiesRotating(), and rotating.
Referenced by Draw().
void RC::DrawCubiesRotating | ( | Graphics::Display & | display | ) | const |
Definition at line 981 of file RC.cpp.
References cubieInPos, cubies, cubiesOnFace, Draw(), faceTurning, notInFaceTurning, and rotatingFaceBehind.
Referenced by DrawCubies().
int RC::Edge12PDBDist | ( | const RCState & | s | ) |
Implements SearchEnvironment< RCState, RCAction >.
Implements SearchEnvironment< RCState, RCAction >.
Reimplemented from SearchEnvironment< RCState, RCAction >.
Definition at line 1267 of file RC.cpp.
References GetNextState().
|
inlinevirtual |
Implements SearchEnvironment< RCState, RCAction >.
Implements SearchEnvironment< RCState, RCAction >.
Definition at line 1235 of file RC.cpp.
References history, and pruneSuccessors.
Referenced by RubiksCubeInstances::GetRandomN().
Reimplemented from SearchEnvironment< RCState, RCAction >.
Definition at line 1303 of file RC.cpp.
References ApplyAction().
Referenced by GetAction(), and GetSuccessors().
uint64_t RC::GetPDBHashCorner | ( | const RCState & | s, |
int | threadID | ||
) | const |
Definition at line 1539 of file RC.cpp.
References corners, RCState::indices, min(), and RCState::rotation.
|
virtual |
Reimplemented from SearchEnvironment< RCState, RCAction >.
void RC::GetStateFromPDBHashCorner | ( | uint64_t | hash, |
RCState & | s, | ||
int | threadID | ||
) | const |
Definition at line 1576 of file RC.cpp.
References corners, RCState::indices, min(), and RCState::rotation.
|
virtual |
Implements SearchEnvironment< RCState, RCAction >.
uint64_t RC::GetStateHashCorner | ( | const RCState & | s | ) |
Definition at line 1625 of file RC.cpp.
References RCState::rotation.
Implements SearchEnvironment< RCState, RCAction >.
Definition at line 1206 of file RC.cpp.
References GetNextState().
|
virtual |
Goal Test if the goal is stored.
Reimplemented from SearchEnvironment< RCState, RCAction >.
Implements SearchEnvironment< RCState, RCAction >.
|
virtual |
Heuristic value between node and the stored goal.
Asserts that the goal is stored
Reimplemented from SearchEnvironment< RCState, RCAction >.
Definition at line 1336 of file RC.cpp.
References HCost().
Heuristic value between two arbitrary nodes.
Implements SearchEnvironment< RCState, RCAction >.
Definition at line 1329 of file RC.cpp.
Referenced by HCost().
Reimplemented from SearchEnvironment< RCState, RCAction >.
Definition at line 1323 of file RC.cpp.
References HCost().
void RC::InterpFaceRot | ( | float | progress | ) |
Definition at line 1133 of file RC.cpp.
References cubieInPos, cubies, cubiesOnFace, faceTurning, interpArr, notInFaceTurning, Cubie::points, Cubie::ResetToBase(), Cubie::RotateRelative(), rotatingFaceBehind, rotationTotal, and turnArr.
Referenced by TestUpdate().
|
virtual |
Implements SearchEnvironment< RCState, RCAction >.
Definition at line 1309 of file RC.cpp.
Referenced by UndoAction().
|
virtual |
Reimplemented from SearchEnvironment< RCState, RCAction >.
Reimplemented from SearchEnvironment< RCState, RCAction >.
Draw the transition at some percentage 0...1 between two states.
Reimplemented from SearchEnvironment< RCState, RCAction >.
void RC::RotateCubies | ( | float | add[3] | ) |
Definition at line 1012 of file RC.cpp.
References cubies, Cubie::ResetToBase(), Cubie::RotateRelative(), and rotationTotal.
Referenced by TestUpdate().
void RC::RotateFace | ( | int | face, |
int | move | ||
) |
Definition at line 1028 of file RC.cpp.
References cornerOrder, cubieInPos, cubies, cubiesOnFace, edgeOrder, faceBlackUnderside, faceTurning, fromFaceToCenter, piOver2, Cubie::RotateBase(), Cubie::RotateFacePos(), rotating, rotProgress, Cubie::SetFacePositionVisible(), and turnArr.
|
inline |
Definition at line 381 of file RC.h.
References history, and pruneSuccessors.
Referenced by RubiksCubeInstances::GetRandomN().
void RC::TestUpdate | ( | ) |
Definition at line 1167 of file RC.cpp.
References cubies, InterpFaceRot(), passiveRot, Cubie::ResetVisibleFace(), RotateCubies(), rotating, rotationTotal, rotProgress, and turnSpd.
Reimplemented from SearchEnvironment< RCState, RCAction >.
Definition at line 1289 of file RC.cpp.
References history, InvertAction(), pruneSuccessors, and RCState::RotateFace().
const int RC::convertStatePos[20] |
const int RC::cornerOrder[4] = {0, 2, 8, 6} |
Definition at line 266 of file RC.h.
Referenced by RotateFace().
std::vector<int> RC::corners |
Definition at line 248 of file RC.h.
Referenced by GetPDBHashCorner(), GetStateFromPDBHashCorner(), and RC().
int RC::cubieInPos[26] |
Definition at line 295 of file RC.h.
Referenced by DrawCubiesRotating(), InterpFaceRot(), RC(), and RotateFace().
|
mutable |
Definition at line 292 of file RC.h.
Referenced by Draw(), DrawCubies(), DrawCubiesRotating(), InterpFaceRot(), RC(), RotateCubies(), RotateFace(), and TestUpdate().
int RC::cubiesOnFace[6][9] |
Definition at line 294 of file RC.h.
Referenced by DrawCubiesRotating(), InterpFaceRot(), RC(), and RotateFace().
const int RC::edgeOrder[4] = {1, 5, 7, 3} |
Definition at line 265 of file RC.h.
Referenced by RotateFace().
const int RC::faceBlackUnderside[6] |
Definition at line 259 of file RC.h.
Referenced by RotateFace().
int RC::faceTurning |
Definition at line 296 of file RC.h.
Referenced by DrawCubiesRotating(), InterpFaceRot(), and RotateFace().
const int RC::fromFaceToCenter[6] |
Definition at line 253 of file RC.h.
Referenced by RotateFace().
|
mutable |
Definition at line 429 of file RC.h.
Referenced by ApplyAction(), GetActions(), SetPruneSuccessors(), and UndoAction().
float RC::interpArr[3] |
Definition at line 302 of file RC.h.
Referenced by InterpFaceRot().
int RC::notInFaceTurning[6][17] |
Definition at line 297 of file RC.h.
Referenced by DrawCubiesRotating(), InterpFaceRot(), and RC().
bool RC::passiveRot = true |
Definition at line 303 of file RC.h.
Referenced by TestUpdate().
const float RC::piOver2 = 1.57079632679 |
Definition at line 263 of file RC.h.
Referenced by RotateFace().
bool RC::pruneSuccessors |
Definition at line 431 of file RC.h.
Referenced by ApplyAction(), GetActions(), RC(), SetPruneSuccessors(), and UndoAction().
bool RC::rotating = false |
Definition at line 298 of file RC.h.
Referenced by DrawCubies(), RotateFace(), and TestUpdate().
bool RC::rotatingFaceBehind = false |
Definition at line 299 of file RC.h.
Referenced by DrawCubiesRotating(), and InterpFaceRot().
float RC::rotationTotal[3] |
Definition at line 293 of file RC.h.
Referenced by Draw(), InterpFaceRot(), RC(), RotateCubies(), and TestUpdate().
float RC::rotProgress = 0 |
Definition at line 300 of file RC.h.
Referenced by RotateFace(), and TestUpdate().
float RC::turnArr[3] |
Definition at line 301 of file RC.h.
Referenced by InterpFaceRot(), and RotateFace().
const float RC::turnSpd = 0.04 |
Definition at line 264 of file RC.h.
Referenced by TestUpdate().