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

#include <RubiksCubeCorners.h>

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

Public Member Functions

 RubiksCorner ()
 
 ~RubiksCorner ()
 
virtual void GetSuccessors (const RubiksCornerState &nodeID, std::vector< RubiksCornerState > &neighbors) const
 
virtual void GetActions (const RubiksCornerState &nodeID, std::vector< RubiksCornersAction > &actions) const
 
virtual RubiksCornersAction GetAction (const RubiksCornerState &s1, const RubiksCornerState &s2) const
 
virtual void ApplyAction (RubiksCornerState &s, RubiksCornersAction a) const
 
void ApplyMove (RubiksCornerState &s, RubikCornerMove *a)
 
void UndoMove (RubiksCornerState &s, RubikCornerMove *a)
 
void unrankPlayer (uint64_t d, RubiksCornerState &s, int who)
 
int64_t getMaxSinglePlayerRank ()
 
int64_t getMaxSinglePlayerRank2 ()
 
int64_t getMaxSinglePlayerRank2 (int64_t firstIndex)
 
RubikCornerMovegetMoves (RubiksCornerState &)
 
void freeMove (RubikCornerMove *m)
 
int64_t rankPlayer (RubiksCornerState &s, int who)
 
void rankPlayerFirstTwo (const RubiksCornerState &s, int who, int64_t &rank)
 
void rankPlayerRemaining (const RubiksCornerState &s, int who, int64_t &rank)
 
void rankPlayer (RubiksCornerState &s, int who, int64_t &index1, int64_t &index2)
 
virtual void GetNextState (const RubiksCornerState &, RubiksCornersAction, RubiksCornerState &) const
 
virtual bool InvertAction (RubiksCornersAction &a) const
 
virtual double HCost (const RubiksCornerState &node1, const RubiksCornerState &node2) const
 Heuristic value between two arbitrary nodes. More...
 
virtual double HCost (const RubiksCornerState &node) const
 Heuristic value between node and the stored goal. More...
 
virtual double GCost (const RubiksCornerState &node1, const RubiksCornerState &node2) const
 
virtual double GCost (const RubiksCornerState &node, const RubiksCornersAction &act) const
 
virtual bool GoalTest (const RubiksCornerState &node, const RubiksCornerState &goal) const
 
virtual bool GoalTest (const RubiksCornerStateBits &node) const
 Goal Test if the goal is stored. More...
 
virtual bool GoalTest (const RubiksCornerStateArray &node) const
 Goal Test if the goal is stored. More...
 
uint64_t GetStateHash (const RubiksCornerState &node) const
 
void GetStateFromHash (uint64_t hash, RubiksCornerState &node) const
 
virtual uint64_t GetActionHash (RubiksCornersAction act) const
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const RubiksCornerState &) const
 
virtual void OpenGLDraw (const RubiksCornerState &, const RubiksCornerState &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void OpenGLDraw (const RubiksCornerState &, const RubiksCornersAction &) const
 
void OpenGLDrawCube (const RubiksCornerState &s, int cube) const
 
- Public Member Functions inherited from SearchEnvironment< RubiksCornerState, RubiksCornersAction >
virtual ~SearchEnvironment ()
 
virtual int GetNumSuccessors (const RubiksCornerState &stateID) const
 
virtual void UndoAction (RubiksCornerState &s, RubiksCornersAction a) const
 
virtual void StoreGoal (RubiksCornerState &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 RubiksCornerState &node1, const RubiksCornerState &node2, double parentHCost) const
 
virtual uint64_t GetMaxHash () const
 
virtual double GetPathLength (std::vector< RubiksCornerState > &neighbors)
 
virtual double GetPathLength (const RubiksCornerState &start, std::vector< RubiksCornersAction > &neighbors)
 
virtual OccupancyInterface< RubiksCornerState, RubiksCornersAction > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< RubiksCornerState, RubiksCornersAction > *)
 
virtual void OpenGLDraw () const
 
virtual void GLLabelState (const RubiksCornerState &, const char *) const
 
virtual void GLDrawLine (const RubiksCornerState &x, const RubiksCornerState &y) const
 
virtual void GLDrawPath (const std::vector< RubiksCornerState > &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 RubiksCornerState &) const
 
virtual void DrawLine (Graphics::Display &display, const RubiksCornerState &x, const RubiksCornerState &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< RubiksCornerState >
 Heuristic ()
 
virtual ~Heuristic ()
 

Private Member Functions

void SetFaceColor (int face, const RubiksCornerState &) const
 

Static Private Member Functions

static uint64_t MRRank (int n, uint64_t perm, uint64_t dual)
 
static void MRUnrank2 (int n, uint64_t r, uint64_t &perm)
 

Private Attributes

RubikCornerMove moves [18]
 

Additional Inherited Members

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

Detailed Description

Definition at line 114 of file RubiksCubeCorners.h.

Constructor & Destructor Documentation

◆ RubiksCorner()

RubiksCorner::RubiksCorner ( )
inline

Definition at line 117 of file RubiksCubeCorners.h.

References RubikCornerMove::act, moves, and RubikCornerMove::next.

◆ ~RubiksCorner()

RubiksCorner::~RubiksCorner ( )
inline

Definition at line 127 of file RubiksCubeCorners.h.

Member Function Documentation

◆ ApplyAction()

void RubiksCorner::ApplyAction ( RubiksCornerState s,
RubiksCornersAction  a 
) const
virtual

◆ ApplyMove()

void RubiksCorner::ApplyMove ( RubiksCornerState s,
RubikCornerMove a 
)

Definition at line 494 of file RubiksCubeCorners.cpp.

References RubikCornerMove::act, and ApplyAction().

◆ freeMove()

void RubiksCorner::freeMove ( RubikCornerMove m)
inline

Definition at line 145 of file RubiksCubeCorners.h.

◆ GCost() [1/2]

virtual double RubiksCorner::GCost ( const RubiksCornerState node,
const RubiksCornersAction act 
) const
inlinevirtual

◆ GCost() [2/2]

virtual double RubiksCorner::GCost ( const RubiksCornerState node1,
const RubiksCornerState node2 
) const
inlinevirtual

◆ GetAction()

RubiksCornersAction RubiksCorner::GetAction ( const RubiksCornerState s1,
const RubiksCornerState s2 
) const
virtual

◆ GetActionHash()

virtual uint64_t RubiksCorner::GetActionHash ( RubiksCornersAction  act) const
inlinevirtual

◆ GetActions()

void RubiksCorner::GetActions ( const RubiksCornerState nodeID,
std::vector< RubiksCornersAction > &  actions 
) const
virtual

◆ getMaxSinglePlayerRank()

int64_t RubiksCorner::getMaxSinglePlayerRank ( )

Definition at line 512 of file RubiksCubeCorners.cpp.

◆ getMaxSinglePlayerRank2() [1/2]

int64_t RubiksCorner::getMaxSinglePlayerRank2 ( )

Definition at line 522 of file RubiksCubeCorners.cpp.

◆ getMaxSinglePlayerRank2() [2/2]

int64_t RubiksCorner::getMaxSinglePlayerRank2 ( int64_t  firstIndex)

Definition at line 526 of file RubiksCubeCorners.cpp.

◆ getMoves()

RubikCornerMove* RubiksCorner::getMoves ( RubiksCornerState )
inline

Definition at line 144 of file RubiksCubeCorners.h.

References moves.

◆ GetNextState()

void RubiksCorner::GetNextState ( const RubiksCornerState s0,
RubiksCornersAction  a,
RubiksCornerState s1 
) const
virtual

Reimplemented from SearchEnvironment< RubiksCornerState, RubiksCornersAction >.

Definition at line 460 of file RubiksCubeCorners.cpp.

References ApplyAction().

Referenced by GetSuccessors().

◆ GetStateFromHash()

void RubiksCorner::GetStateFromHash ( uint64_t  hash,
RubiksCornerState node 
) const
virtual

◆ GetStateHash()

uint64_t RubiksCorner::GetStateHash ( const RubiksCornerState node) const
virtual

◆ GetSuccessors()

void RubiksCorner::GetSuccessors ( const RubiksCornerState nodeID,
std::vector< RubiksCornerState > &  neighbors 
) const
virtual

◆ GoalTest() [1/3]

virtual bool RubiksCorner::GoalTest ( const RubiksCornerState node,
const RubiksCornerState goal 
) const
inlinevirtual

Implements SearchEnvironment< RubiksCornerState, RubiksCornersAction >.

Definition at line 169 of file RubiksCubeCorners.h.

References GoalTest().

Referenced by GoalTest().

◆ GoalTest() [2/3]

bool RubiksCorner::GoalTest ( const RubiksCornerStateArray node) const
virtual

Goal Test if the goal is stored.

Reimplemented from SearchEnvironment< RubiksCornerState, RubiksCornersAction >.

Definition at line 486 of file RubiksCubeCorners.cpp.

◆ GoalTest() [3/3]

bool RubiksCorner::GoalTest ( const RubiksCornerStateBits node) const
virtual

Goal Test if the goal is stored.

Definition at line 481 of file RubiksCubeCorners.cpp.

◆ HCost() [1/2]

virtual double RubiksCorner::HCost ( const RubiksCornerState node) const
inlinevirtual

Heuristic value between node and the stored goal.

Asserts that the goal is stored

Reimplemented from SearchEnvironment< RubiksCornerState, RubiksCornersAction >.

Definition at line 164 of file RubiksCubeCorners.h.

◆ HCost() [2/2]

virtual double RubiksCorner::HCost ( const RubiksCornerState node1,
const RubiksCornerState node2 
) const
inlinevirtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< RubiksCornerState, RubiksCornersAction >.

Definition at line 160 of file RubiksCubeCorners.h.

◆ InvertAction()

bool RubiksCorner::InvertAction ( RubiksCornersAction a) const
virtual

◆ MRRank()

uint64_t RubiksCorner::MRRank ( int  n,
uint64_t  perm,
uint64_t  dual 
)
staticprivate

Definition at line 640 of file RubiksCubeCorners.cpp.

References get(), and swap().

Referenced by GetStateHash(), and rankPlayerRemaining().

◆ MRUnrank2()

void RubiksCorner::MRUnrank2 ( int  n,
uint64_t  r,
uint64_t &  perm 
)
staticprivate

Definition at line 731 of file RubiksCubeCorners.cpp.

References swap().

Referenced by GetStateFromHash().

◆ OpenGLDraw() [1/4]

void RubiksCorner::OpenGLDraw ( ) const
virtual

Definition at line 741 of file RubiksCubeCorners.cpp.

Referenced by RubiksCube::OpenGLDraw(), and RubiksCube::OpenGLDrawCorners().

◆ OpenGLDraw() [2/4]

void RubiksCorner::OpenGLDraw ( const RubiksCornerState s) const
virtual

◆ OpenGLDraw() [3/4]

void RubiksCorner::OpenGLDraw ( const RubiksCornerState ,
const RubiksCornersAction  
) const
virtual

◆ OpenGLDraw() [4/4]

void RubiksCorner::OpenGLDraw ( const RubiksCornerState ,
const RubiksCornerState ,
float   
) const
virtual

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

Reimplemented from SearchEnvironment< RubiksCornerState, RubiksCornersAction >.

Definition at line 1120 of file RubiksCubeCorners.cpp.

◆ OpenGLDrawCube()

void RubiksCorner::OpenGLDrawCube ( const RubiksCornerState s,
int  cube 
) const

Definition at line 766 of file RubiksCubeCorners.cpp.

References SetFaceColor().

Referenced by OpenGLDraw(), and RubiksCube::OpenGLDraw().

◆ rankPlayer() [1/2]

int64_t RubiksCorner::rankPlayer ( RubiksCornerState s,
int  who 
)
inline

Definition at line 147 of file RubiksCubeCorners.h.

References GetStateHash().

◆ rankPlayer() [2/2]

void RubiksCorner::rankPlayer ( RubiksCornerState s,
int  who,
int64_t &  index1,
int64_t &  index2 
)
inline

Definition at line 151 of file RubiksCubeCorners.h.

References rankPlayerFirstTwo(), and rankPlayerRemaining().

◆ rankPlayerFirstTwo()

void RubiksCorner::rankPlayerFirstTwo ( const RubiksCornerState s,
int  who,
int64_t &  rank 
)

Definition at line 531 of file RubiksCubeCorners.cpp.

References RubiksCornerStateArray::GetCubeOrientation().

Referenced by rankPlayer().

◆ rankPlayerRemaining()

void RubiksCorner::rankPlayerRemaining ( const RubiksCornerState s,
int  who,
int64_t &  rank 
)

Definition at line 536 of file RubiksCubeCorners.cpp.

References Factorial(), MRRank(), and set().

Referenced by rankPlayer().

◆ SetFaceColor()

void RubiksCorner::SetFaceColor ( int  face,
const RubiksCornerState s 
) const
private

Definition at line 1130 of file RubiksCubeCorners.cpp.

References RubiksCornerStateArray::GetFaceInLoc().

Referenced by OpenGLDrawCube().

◆ UndoMove()

void RubiksCorner::UndoMove ( RubiksCornerState s,
RubikCornerMove a 
)

Definition at line 498 of file RubiksCubeCorners.cpp.

References RubikCornerMove::act, and ApplyAction().

◆ unrankPlayer()

void RubiksCorner::unrankPlayer ( uint64_t  d,
RubiksCornerState s,
int  who 
)
inline

Definition at line 135 of file RubiksCubeCorners.h.

References d, and GetStateFromHash().

Member Data Documentation

◆ moves

RubikCornerMove RubiksCorner::moves[18]
private

Definition at line 191 of file RubiksCubeCorners.h.

Referenced by getMoves(), and RubiksCorner().


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