HOG2
RC.h
Go to the documentation of this file.
1 //
2 // RC.h (Alternate Rubik's Cube implementation)
3 //
4 // Created by Nathan Sturtevant on 7/9/21.
5 //
6 
7 #ifndef __RC__
8 #define __RC__
9 
10 #include <iostream>
11 #include <stdint.h>
12 #include <unordered_map>
13 #include <vector>
14 #include <array>
15 #include "SearchEnvironment.h"
16 #include "PDBHeuristic.h"
17 
18 /*===============================================================================================================================================================================
19  * CUBIE CLASS
20  ===============================================================================================================================================================================*/
21 
22 /* Contains all data necessary to DRAW a cubie
23  * Can draw itself
24  */
25 
26 class Cubie
27 {
28 public:
29  //Changing Variables
30  std::vector<Graphics::point> basePoints;
31  std::vector<std::vector<Graphics::point>> baseFacePoints;
32  std::vector<Graphics::point> points;
33  std::vector<std::vector<Graphics::point>> facePoints;
35  int index;
36  int RCindex = -1; //TEMP
37  bool facesShown [6];
38  int blackFaceToReset = -1;
39  int faceInPos [6] = {0,1,2,3,4,5};
40 
41  //Constants
42  const float sideLen = 0.2f;
43  const float faceSize = 0.85f;
44  const rgbColor outCol = rgbColor(0.f, 0.f, 0.f);
45  const rgbColor inCol = rgbColor(0.04f, 0.04f, 0.06f);
46  const std::vector<std::vector<float>> projection =
47  {
48  {1, 0, 0},
49  {0, 1, 0}
50  };
51  const int pointsOnFace [6][4] =
52  {
53  {0, 1, 5, 4},
54  {0, 1, 2, 3},
55  {3, 0, 4, 7},
56  {4, 5, 6, 7},
57  {1, 2, 6, 5},
58  {2, 3, 7, 6}
59  };
60  const rgbColor faceColors [6] =
61  {
62  rgbColor(255.f, 255.f, 255.f), // sf::Color::White,
63  rgbColor(0.f, 0.f, 255.f), // sf::Color::Blue,
64  rgbColor(255.f, 0.f, 0.f), // sf::Color::Red,
65  rgbColor(0.f, 255.f, 0.f), // sf::Color::Green,
66  Colors::orange, //rgbColor(255.f, 89.f, 0.f), // orangeCol,
67  Colors::yellow //rgbColor(255.f, 240.f, 31.f), // sf::Color::Yellow,
68  };
69  const int faceOrderByAxis [3][4] =
70  {
71  {0,1,5,3},
72  {1,2,3,4},
73  {0,4,5,2}
74  };
75  const int facesShowing [20][3] =
76  {
77  // Visible faces for a given cubie position
78  /* (With blue at front and white at top}
79  * 0 = Top
80  * 1 = Front
81  * 2 = Left
82  * 3 = Right
83  * 4 = Back
84  * 5 = Bottom
85  * -1 = N/A
86  */
87 
88  // Also represents the colors present on a given cubie index
89  /* 0 = White... 5 = Yellow
90  * For corners, the colors are listed in a CLOCKWISE order from the face of index 0/5
91  * The face
92  */
93 
94  // Edges
95  {0, 2, -1}, //0
96  {1, 2, -1}, //1
97  {0, 1, -1}, //2
98  {1, 4, -1}, //3
99  {0, 4, -1}, //4
100  {3, 4, -1}, //5
101  {0, 3, -1}, //6
102  {3, 2, -1}, //7
103  {5, 2, -1}, //8
104  {5, 1, -1}, //9
105  {5, 4, -1}, //10
106  {5, 3, -1}, //11
107  // Corners
108  {0, 1, 2}, //12
109  {0, 4, 1}, //13
110  {0, 3, 4}, //14
111  {0, 2, 3}, //15
112  {5, 2, 1}, //16
113  {5, 1, 4}, //17
114  {5, 4, 3}, //18
115  {5, 3, 2} //19
116  };
117 
118  void Initialize(int ind);
119  void Initialize(int RCpos, int RCind, int RCrot);
120  void Draw(Graphics::Display &display) const;
121  void DrawFace(Graphics::Display &display, int index) const;
122  void RotateRelative(const float angle[3]);
123  void RotateBase(float angle [3]);
124  void RotateFacePos(bool clockwise, int axis);
125  void ResetToBase();
126  void ResetVisibleFace();
127  void SetFacePositionVisible(bool toggle, int position);
128  void PrintData();
129  //Cubie & operator=(const Cubie & rhs);
130 };
131 
132 /*===============================================================================================================================================================================
133  * RCSTATE CLASS
134  ===============================================================================================================================================================================*/
135 
136 class RCState
137 {
138 public:
140  {
141  Reset();
142  }
143  void Reset()
144  {
145  // Set all values to default
146  for (int i = 0; i < 20; i++)
147  {
148  indices[i] = i;
149  rotation[i] = 0;
150  }
151  }
152  // 12 edges followed by 8 corners
153  int indices[20]; //Index of cubie in position //uint8_t
154  int rotation[20]; //Rotation of cubie in position
155 
156 //const int edgesOnFace[6][4] =
157 //{
158 // {0, 6, 4, 2}, //0
159 // {2, 3, 9, 1}, //1
160 // {0, 1, 8, 7}, //2
161 // {6, 7, 11, 5}, //3
162 // {4, 5, 10, 3}, //4
163 // {9, 10, 11, 8} //5
164 //};
165 // int cornersOnFace[6][4] =
166 // {
167 // {4 +11, 3 +11, 2 +11, 1 +11}, //0
168 // {1 +11, 2 +11, 6 +11, 5 +11}, //1
169 // {4 +11, 1 +11, 5 +11, 8 +11}, //2
170 // {3 +11, 4 +11, 8 +11, 7 +11}, //3
171 // {2 +11, 3 +11, 7 +11, 6 +11}, //4
172 // {5 +11, 6 +11, 7 +11, 8 +11} //5
173 // };
174 //const int cornersOnFace[6][4] =
175 //{
176 // {15, 14, 13, 12}, //0
177 // {16, 12, 13, 17}, //1
178 // {15, 12, 16, 19}, //2
179 // {15, 19, 18, 14}, //3
180 // {13, 14, 18, 17}, //4
181 // {16, 17, 18, 19} //5
182 //};
183 
184  // Move to RC Class
185  void RotateFace(int move);
186  void RotateEdges(int move);
187  void RotateCorners(int move);
188  void SwapPositions(int p1, int p2);
189  void ShiftPositionsCW(const int (&arr)[4]);
190  void ShiftPositionsCCW(const int (&arr)[4]);
191  //
192 
193  void PrintState();
194 
195  // TODO: Remove
196  void RotateFace(int face, int move);
197  void RotateEdges(int face, int move);
198  void RotateCorners(int face, int move);
199  void ShiftPositions(const int (&arr)[4], bool forward);
200 };
201 
202 typedef int RCAction;
203 
204 static std::ostream &operator<<(std::ostream &out, RCState &tmp)
205 {
206  for (int x = 0; x < 20; x++)
207  out << tmp.rotation[x] << " : ";
208  return out;
209 
210 }
211 
212 // Can't write these until data structures are defined
213 static bool operator==(const RCState &l1, const RCState &l2)
214 {
215  for (int x = 0; x < 20; x++)
216  {
217  if (l1.indices[x] != l2.indices[x])
218  return false;
219  if (l1.rotation[x] != l2.rotation[x])
220  return false;
221  }
222  return true;
223  //return false;
224  //return (l1.corner == l2.corner) && (l1.edge == l2.edge);
225 }
226 //
227 //static bool operator!=(const RCState &l1, const RCState &l2)
228 //{
229 // return !(l1 == l2);
230 //}
231 //
232 //static std::ostream &operator<<(std::ostream &out, const RCState &s)
233 //{
234 // out << "{" << s.edge << ", " << s.corner << "}";
235 // return out;
236 //}
237 
238 //void drawCube(Graphics::Display &display, int xPos, int yPos, int zPos, float tempAngle);
239 
240 /*===============================================================================================================================================================================
241  * RC CLASS
242  ===============================================================================================================================================================================*/
243 
244 class RC : public SearchEnvironment<RCState, RCAction>
245 {
246 public:
247  // RELATED TO HASH FUNCTION
248  std::vector<int> corners;
249  std::vector<int> edges;
250 
251 
252  //Constants TODO: MOVE TO BOTTOM
253  const int fromFaceToCenter[6] =
254  // Modifier: e.g. cubies on face 0 simply add 3 to their own position to get the position
255  // of the layer of cubies to get the position of the cubie 1 towards the center of the cubie
256  {
257  3, 9, 1, -9, -1, -3
258  };
259  const int faceBlackUnderside[6] =
260  {
261  5, 3, 4, 1, 2, 0
262  };
263  const float piOver2 = 1.57079632679;
264  const float turnSpd = 0.04;
265  const int edgeOrder [4] = {1, 5, 7, 3};
266  const int cornerOrder [4] = {0, 2, 8, 6};
267  const int convertStatePos [20] =
268  { // Converts from RCState cubie indices to RC indices
269  9, // 0
270  3, // 1
271  1, // 2
272  5, // 3
273  11,// 4
274  22,// 5
275  18,// 6
276  20,// 7
277  14,// 8
278  7, // 9
279  16,// 10
280  24,// 11
281  0, // 12
282  2, // 13
283  19,// 14
284  17,// 15
285  6, // 16
286  8, // 17
287  25,// 18
288  23 // 19
289  };
290 
291  //Cubie Object items
292  mutable Cubie cubies [26];
293  float rotationTotal [3];
294  int cubiesOnFace [6][9]; //Face, position
295  int cubieInPos[26];
297  int notInFaceTurning[6][17];
298  bool rotating = false;
299  bool rotatingFaceBehind = false;
300  float rotProgress = 0;
301  float turnArr[3];
302  float interpArr[3];
303  bool passiveRot = true;
304 
305  void DrawCubies(Graphics::Display &display) const;
306  void DrawCubiesRotating(Graphics::Display &display) const;
307  void RotateCubies(float add[3]);
308  void RotateFace(int face, int move);
309  void InterpFaceRot(float progress);
310  void TestUpdate();
311 
312  RC()
313  {
314  // HASH FUNCTION RELATED
315  corners.resize(8);
316  for (int i = 0; i < 8; i++)
317  {
318  corners[i] = i;
319  }
320  edges.resize(12);
321  for (int i = 0; i < 12; i++)
322  {
323  edges[i] = i;
324  }
325 
326  pruneSuccessors = false;
327  for (int i = 0; i < 26; i++)
328  {
329  //std::cout << cubies[i].a << '\n';
330  cubies[i].Initialize(i);
331  cubieInPos[i] = i;
332  }
333  for (int i = 0; i < 3; i++)
334  {
335  rotationTotal[i] = 0.f;
336  }
337  // Initialize cubiesOnFace
338  for (int i = 0; i < 9; i++)
339  {
340  int in = (i/3)*-9 + (i%3) + 18; in -= in/14;
341  cubiesOnFace[0][i] = in;
342  in = (i/3)*9 + (i%3) + 6; in -= in/14;
343  cubiesOnFace[5][i] = in;
344 
345  in = (i/3)*3 + (i%3)*-9 + 18; in -= in/14;
346  cubiesOnFace[2][i] = in;
347  in = (i/3)*3 + (i%3)*9 + 2; in -= in/14;
348  cubiesOnFace[4][i] = in;
349 
350  cubiesOnFace[1][i] = i;
351  in = (i/3)*3 - (i%3) + 20; in -= in/14;
352  cubiesOnFace[3][i] = in;
353  }
354 
355  //Initialize notInFaceTurning
356  for (int i = 0; i < 6; i++)
357  {
358  int j = 0;
359  for (int k = 0; k < 26; k++)
360  {
361  bool add = true;
362  for (int l = 0; l < 9; l++)
363  {
364  if (cubiesOnFace[i][l] == k)
365  {
366  //Don't add it to the list
367  add = false;
368  break;
369  }
370  }
371  if (add)
372  {
373  notInFaceTurning[i][j] = k;
374  j++;
375  }
376  }
377  }
378  }
379 
380  std::string GetName() { return "RC"; }
381  void SetPruneSuccessors(bool val) { pruneSuccessors = val; history.resize(0); }
382  void GetSuccessors(const RCState &nodeID, std::vector<RCState> &neighbors) const;
383  void GetActions(const RCState &nodeID, std::vector<RCAction> &actions) const;
384  void GetPrunedActions(const RCState &nodeID, RCAction lastAction, std::vector<RCAction> &actions) const;
385  RCAction GetAction(const RCState &s1, const RCState &s2) const;
386  void ApplyAction(RCState &s, RCAction a) const;
387  void UndoAction(RCState &s, RCAction a) const;
388 
389  void GetNextState(const RCState &, RCAction , RCState &) const;
390 
391  bool InvertAction(RCAction &a) const;
392 
394  double HCost(const RCState &node1, const RCState &node2) const;
395  double HCost(const RCState &node1, const RCState &node2, double parentHCost) const;
396  int Edge12PDBDist(const RCState &s);
397 
400  double HCost(const RCState &node) const;
401 
402  double GCost(const RCState &node1, const RCState &node2) const { return 1.0; }
403  double GCost(const RCState &node, const RCAction &act) const { return 1.0; }
404  bool GoalTest(const RCState &node, const RCState &goal) const;
405 
407  bool GoalTest(const RCState &node) const;
408 
409  uint64_t GetStateHash(const RCState &node) const;
410 
411  uint64_t GetActionHash(RCAction act) const { return act; }
412  void GetStateFromHash(uint64_t hash, RCState &node) const;
413 
414  void OpenGLDraw() const;
415  void OpenGLDraw(const RCState&) const;
416  void OpenGLDrawCorners(const RCState&) const;
417  void OpenGLDrawEdges(const RCState&) const;
418  void OpenGLDrawEdgeDual(const RCState&) const;
419  void OpenGLDrawCenters() const;
420  void OpenGLDrawCubeBackground() const;
422  void OpenGLDraw(const RCState&, const RCState&, float) const;
423  void OpenGLDraw(const RCState&, const RCAction&) const;
424 
425  void Draw(Graphics::Display &display, const RCState&) const;
426 
427  void OpenGLDrawCube(int cube) const;
428  void SetFaceColor(int face) const;
429  mutable std::vector<RCAction> history;
430 
432 
433  // HASH FUNCTION
434  // CORNERS
435  uint64_t GetPDBSizeCorner() const;
436  uint64_t GetPDBHashCorner(const RCState &s, int threadID) const;
437  void GetStateFromPDBHashCorner(uint64_t hash, RCState &s, int threadID) const;
438  uint64_t GetStateHashCorner(const RCState &s);
439 
440  // EDGES
441 // uint64_t GetPDBSizeEdge() const;
442 // uint64_t GetPDBHashEdge(const RCState &s, int threadID) const;
443 // void GetStateFromPDBHashEdge(uint64_t hash, RCState &s, int threadID) const;
444 // uint64_t GetStateHashEdge(const RCState &s);
445 
446  uint64_t FactorialUpperK(int n, int k) const;
447 };
448 
449 class RCPDB : public PDBHeuristic<RCState, RCAction, RC, RCState, 4> {
450 public:
451  RCPDB(RC *e,
452  const std::array<bool, 12> &edgeRotations, const std::array<bool, 12> &edgeLocations,
453  const std::array<bool, 8> &cornerRotations, const std::array<bool, 8> &cornerLocations);
454  uint64_t GetStateHash(const RCState &s) const;
455  void GetStateFromHash(RCState &s, uint64_t hash) const;
456  uint64_t GetPDBSize() const;
457  uint64_t GetPDBHash(const RCState &s, int threadID = 0) const;
458  uint64_t GetAbstractHash(const RCState &s, int threadID = 0) const { return GetPDBHash(s); }
459  void GetStateFromPDBHash(uint64_t hash, RCState &s, int threadID = 0) const;
460  RCState GetStateFromAbstractState(RCState &s) const { return s; }
461 
462  void OpenGLDraw() const
463  {}
464 
465  // const char *GetName();
466  bool Load(const char *prefix) { return false; }
467  void Save(const char *prefix) {}
468  bool Load(FILE *f){ return false; }
469  void Save(FILE *f){}
470  std::string GetFileName(const char *prefix) {return "";}
471 private:
472  uint64_t FactorialUpperK(int n, int k) const;
473 
474  uint64_t GetEdgeRotationSize() const;
475  uint64_t GetEdgeLocationSize() const;
476  uint64_t GetCornerRotationSize() const;
477  uint64_t GetCornerLocationSize() const;
478  uint64_t GetEdgeRotationHash(const RCState &s) const;
479  uint64_t GetEdgeLocationHash(const RCState &s) const;
480  uint64_t GetCornerRotationHash(const RCState &s) const;
481  uint64_t GetCornerLocationHash(const RCState &s) const;
482  void GetStateFromEdgeRotationHash(RCState &s, uint64_t hash) const;
483  void GetStateFromEdgeLocationHash(RCState &s, uint64_t hash) const;
484  void GetStateFromCornerRotationHash(RCState &s, uint64_t hash) const;
485  void GetStateFromCornerLocationHash(RCState &s, uint64_t hash) const;
486 
487  std::vector<int> edgeRotations;
488  std::vector<int> edgeLocations;
489  std::vector<int> cornerRotations;
490  std::vector<int> cornerLocations;
491 };
492 
493 #endif /* defined(__hog2_glut__RubiksCube__) */
RC::turnArr
float turnArr[3]
Definition: RC.h:301
Cubie::faceColors
const rgbColor faceColors[6]
Definition: RC.h:60
RCPDB::GetEdgeRotationSize
uint64_t GetEdgeRotationSize() const
Definition: RC.cpp:1865
RC::edges
std::vector< int > edges
Definition: RC.h:249
RCAction
int RCAction
Definition: RC.h:202
RCState::RotateEdges
void RotateEdges(int move)
Definition: RC.cpp:748
RC::UndoAction
void UndoAction(RCState &s, RCAction a) const
Definition: RC.cpp:1289
RC::GetAction
RCAction GetAction(const RCState &s1, const RCState &s2) const
Definition: RC.cpp:1267
rgbColor
A color; r/g/b are between 0...1.
Definition: Colors.h:17
RCState::RCState
RCState()
Definition: RC.h:139
Cubie::faceOrderByAxis
const int faceOrderByAxis[3][4]
Definition: RC.h:69
RC::rotating
bool rotating
Definition: RC.h:298
RCPDB::GetFileName
std::string GetFileName(const char *prefix)
Definition: RC.h:470
RCPDB::GetStateFromEdgeRotationHash
void GetStateFromEdgeRotationHash(RCState &s, uint64_t hash) const
Definition: RC.cpp:1973
RC::DrawCubiesRotating
void DrawCubiesRotating(Graphics::Display &display) const
Definition: RC.cpp:981
RC::Edge12PDBDist
int Edge12PDBDist(const RCState &s)
operator<<
static std::ostream & operator<<(std::ostream &out, RCState &tmp)
Definition: RC.h:204
RC::piOver2
const float piOver2
Definition: RC.h:263
RC::GetStateFromPDBHashCorner
void GetStateFromPDBHashCorner(uint64_t hash, RCState &s, int threadID) const
Definition: RC.cpp:1576
RC::OpenGLDrawEdges
void OpenGLDrawEdges(const RCState &) const
Definition: RC.cpp:1379
RC::RC
RC()
Definition: RC.h:312
Cubie::projection
const std::vector< std::vector< float > > projection
Definition: RC.h:46
RCPDB::GetStateFromHash
void GetStateFromHash(RCState &s, uint64_t hash) const
Definition: RC.cpp:1786
RC::GetStateFromHash
void GetStateFromHash(uint64_t hash, RCState &node) const
Definition: RC.cpp:1365
Cubie::Initialize
void Initialize(int ind)
Definition: RC.cpp:224
RC::RotateFace
void RotateFace(int face, int move)
Definition: RC.cpp:1028
RCPDB::GetEdgeLocationSize
uint64_t GetEdgeLocationSize() const
Definition: RC.cpp:1871
RC::faceTurning
int faceTurning
Definition: RC.h:296
RCPDB::GetEdgeRotationHash
uint64_t GetEdgeRotationHash(const RCState &s) const
Definition: RC.cpp:1888
RC
Definition: RC.h:244
RC::faceBlackUnderside
const int faceBlackUnderside[6]
Definition: RC.h:259
Cubie::facesShowing
const int facesShowing[20][3]
Definition: RC.h:75
RCState::ShiftPositionsCCW
void ShiftPositionsCCW(const int(&arr)[4])
Definition: RC.cpp:883
RCPDB::GetCornerLocationSize
uint64_t GetCornerLocationSize() const
Definition: RC.cpp:1883
RC::pruneSuccessors
bool pruneSuccessors
Definition: RC.h:431
RCPDB::edgeLocations
std::vector< int > edgeLocations
Definition: RC.h:488
RC::InterpFaceRot
void InterpFaceRot(float progress)
Definition: RC.cpp:1133
RCPDB::Save
void Save(const char *prefix)
Definition: RC.h:467
Cubie::ResetVisibleFace
void ResetVisibleFace()
Definition: RC.cpp:536
RC::passiveRot
bool passiveRot
Definition: RC.h:303
RC::cubieInPos
int cubieInPos[26]
Definition: RC.h:295
RC::SetPruneSuccessors
void SetPruneSuccessors(bool val)
Definition: RC.h:381
RCPDB::GetCornerRotationSize
uint64_t GetCornerRotationSize() const
Definition: RC.cpp:1876
RCState::PrintState
void PrintState()
Definition: RC.cpp:940
Cubie::RCindex
int RCindex
Definition: RC.h:36
RC::OpenGLDrawCorners
void OpenGLDrawCorners(const RCState &) const
Definition: RC.cpp:1376
RCState::indices
int indices[20]
Definition: RC.h:153
RC::fromFaceToCenter
const int fromFaceToCenter[6]
Definition: RC.h:253
RC::GetName
std::string GetName()
Definition: RC.h:380
RC::OpenGLDrawCubeBackground
void OpenGLDrawCubeBackground() const
Definition: RC.cpp:1385
RC::cubies
Cubie cubies[26]
Definition: RC.h:292
RCState::rotation
int rotation[20]
Definition: RC.h:154
RC::GetPrunedActions
void GetPrunedActions(const RCState &nodeID, RCAction lastAction, std::vector< RCAction > &actions) const
Definition: RC.cpp:1215
RC::rotProgress
float rotProgress
Definition: RC.h:300
RCPDB::GetEdgeLocationHash
uint64_t GetEdgeLocationHash(const RCState &s) const
Definition: RC.cpp:1900
Cubie::facePoints
std::vector< std::vector< Graphics::point > > facePoints
Definition: RC.h:33
RCPDB::GetStateFromPDBHash
void GetStateFromPDBHash(uint64_t hash, RCState &s, int threadID=0) const
Definition: RC.cpp:1822
RC::FactorialUpperK
uint64_t FactorialUpperK(int n, int k) const
Definition: RC.cpp:1740
Cubie::faceInPos
int faceInPos[6]
Definition: RC.h:39
RC::GetActions
void GetActions(const RCState &nodeID, std::vector< RCAction > &actions) const
Definition: RC.cpp:1235
RCPDB::GetStateFromCornerLocationHash
void GetStateFromCornerLocationHash(RCState &s, uint64_t hash) const
Definition: RC.cpp:2058
Cubie::outCol
const rgbColor outCol
Definition: RC.h:44
RCPDB::GetStateHash
uint64_t GetStateHash(const RCState &s) const
Definition: RC.cpp:1781
RC::GetPDBHashCorner
uint64_t GetPDBHashCorner(const RCState &s, int threadID) const
Definition: RC.cpp:1539
RCState::RotateCorners
void RotateCorners(int move)
Definition: RC.cpp:775
Cubie::pointsOnFace
const int pointsOnFace[6][4]
Definition: RC.h:51
RCPDB::Save
void Save(FILE *f)
Definition: RC.h:469
RC::rotationTotal
float rotationTotal[3]
Definition: RC.h:293
Cubie::sideLen
const float sideLen
Definition: RC.h:42
RC::SetFaceColor
void SetFaceColor(int face) const
Definition: RC.cpp:1394
RC::notInFaceTurning
int notInFaceTurning[6][17]
Definition: RC.h:297
RC::GoalTest
bool GoalTest(const RCState &node, const RCState &goal) const
Definition: RC.cpp:1341
RCState::Reset
void Reset()
Definition: RC.h:143
RCPDB::GetCornerLocationHash
uint64_t GetCornerLocationHash(const RCState &s) const
Definition: RC.cpp:1942
RC::interpArr
float interpArr[3]
Definition: RC.h:302
RCState::ShiftPositionsCW
void ShiftPositionsCW(const int(&arr)[4])
Definition: RC.cpp:858
RCPDB::RCPDB
RCPDB(RC *e, const std::array< bool, 12 > &edgeRotations, const std::array< bool, 12 > &edgeLocations, const std::array< bool, 8 > &cornerRotations, const std::array< bool, 8 > &cornerLocations)
Definition: RC.cpp:1760
RCPDB::cornerLocations
std::vector< int > cornerLocations
Definition: RC.h:490
PDBHeuristic
Definition: PDBHeuristic.h:39
Graphics::Display
Definition: Graphics.h:146
RCPDB::edgeRotations
std::vector< int > edgeRotations
Definition: RC.h:487
RC::rotatingFaceBehind
bool rotatingFaceBehind
Definition: RC.h:299
Cubie::Draw
void Draw(Graphics::Display &display) const
Definition: RC.cpp:350
Cubie::RotateRelative
void RotateRelative(const float angle[3])
Definition: RC.cpp:433
Cubie
Definition: RC.h:26
RCPDB
Definition: RC.h:449
RC::cubiesOnFace
int cubiesOnFace[6][9]
Definition: RC.h:294
Cubie::facesShown
bool facesShown[6]
Definition: RC.h:37
operator==
static bool operator==(const RCState &l1, const RCState &l2)
Definition: RC.h:213
RCPDB::OpenGLDraw
void OpenGLDraw() const
Definition: RC.h:462
RC::InvertAction
bool InvertAction(RCAction &a) const
Definition: RC.cpp:1309
RCState
Definition: RC.h:136
RCPDB::GetStateFromCornerRotationHash
void GetStateFromCornerRotationHash(RCState &s, uint64_t hash) const
Definition: RC.cpp:2035
RCState::RotateFace
void RotateFace(int move)
Definition: RC.cpp:650
Cubie::RotateFacePos
void RotateFacePos(bool clockwise, int axis)
Definition: RC.cpp:489
Cubie::inCol
const rgbColor inCol
Definition: RC.h:45
Cubie::points
std::vector< Graphics::point > points
Definition: RC.h:32
RC::GetSuccessors
void GetSuccessors(const RCState &nodeID, std::vector< RCState > &neighbors) const
Definition: RC.cpp:1206
RC::DrawCubies
void DrawCubies(Graphics::Display &display) const
Definition: RC.cpp:964
Cubie::basePoints
std::vector< Graphics::point > basePoints
Definition: RC.h:30
RC::OpenGLDrawCube
void OpenGLDrawCube(int cube) const
Definition: RC.cpp:1391
RCPDB::GetPDBHash
uint64_t GetPDBHash(const RCState &s, int threadID=0) const
Definition: RC.cpp:1797
RC::corners
std::vector< int > corners
Definition: RC.h:248
RC::GetStateHash
uint64_t GetStateHash(const RCState &node) const
Definition: RC.cpp:1359
RC::ApplyAction
void ApplyAction(RCState &s, RCAction a) const
Definition: RC.cpp:1282
RC::turnSpd
const float turnSpd
Definition: RC.h:264
Cubie::faceCols
rgbColor faceCols[6]
Definition: RC.h:34
RC::Draw
void Draw(Graphics::Display &display, const RCState &) const
Definition: RC.cpp:1408
RC::convertStatePos
const int convertStatePos[20]
Definition: RC.h:267
RC::GetStateHashCorner
uint64_t GetStateHashCorner(const RCState &s)
Definition: RC.cpp:1625
RCPDB::GetStateFromAbstractState
RCState GetStateFromAbstractState(RCState &s) const
Definition: RC.h:460
Colors::orange
const rgbColor orange
Definition: Colors.h:155
RCState::ShiftPositions
void ShiftPositions(const int(&arr)[4], bool forward)
Definition: RC.cpp:908
Cubie::ResetToBase
void ResetToBase()
Definition: RC.cpp:514
Colors::yellow
const rgbColor yellow
Definition: Colors.h:148
Cubie::index
int index
Definition: RC.h:35
RCPDB::Load
bool Load(const char *prefix)
Definition: RC.h:466
Cubie::blackFaceToReset
int blackFaceToReset
Definition: RC.h:38
Cubie::RotateBase
void RotateBase(float angle[3])
Definition: RC.cpp:461
Cubie::baseFacePoints
std::vector< std::vector< Graphics::point > > baseFacePoints
Definition: RC.h:31
RC::OpenGLDraw
void OpenGLDraw() const
Definition: RC.cpp:1370
RC::HCost
double HCost(const RCState &node1, const RCState &node2) const
Heuristic value between two arbitrary nodes.
Definition: RC.cpp:1329
Cubie::PrintData
void PrintData()
Definition: RC.cpp:557
RC::history
std::vector< RCAction > history
Definition: RC.h:429
RCPDB::Load
bool Load(FILE *f)
Definition: RC.h:468
PDBHeuristic.h
RC::GetPDBSizeCorner
uint64_t GetPDBSizeCorner() const
Definition: RC.cpp:1533
RC::OpenGLDrawCenters
void OpenGLDrawCenters() const
Definition: RC.cpp:1388
RCPDB::GetAbstractHash
uint64_t GetAbstractHash(const RCState &s, int threadID=0) const
Definition: RC.h:458
RCState::SwapPositions
void SwapPositions(int p1, int p2)
Definition: RC.cpp:844
Cubie::DrawFace
void DrawFace(Graphics::Display &display, int index) const
Definition: RC.cpp:417
RC::OpenGLDrawEdgeDual
void OpenGLDrawEdgeDual(const RCState &) const
Definition: RC.cpp:1382
RCPDB::GetStateFromEdgeLocationHash
void GetStateFromEdgeLocationHash(RCState &s, uint64_t hash) const
Definition: RC.cpp:1998
Cubie::SetFacePositionVisible
void SetFacePositionVisible(bool toggle, int position)
Definition: RC.cpp:548
RCPDB::GetPDBSize
uint64_t GetPDBSize() const
Definition: RC.cpp:1791
SearchEnvironment
Definition: SearchEnvironment.h:30
RC::RotateCubies
void RotateCubies(float add[3])
Definition: RC.cpp:1012
RCPDB::FactorialUpperK
uint64_t FactorialUpperK(int n, int k) const
Definition: RC.cpp:2095
RC::edgeOrder
const int edgeOrder[4]
Definition: RC.h:265
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
SearchEnvironment.h
RC::GetNextState
void GetNextState(const RCState &, RCAction, RCState &) const
Definition: RC.cpp:1303
RC::GCost
double GCost(const RCState &node1, const RCState &node2) const
Definition: RC.h:402
RC::GCost
double GCost(const RCState &node, const RCAction &act) const
Definition: RC.h:403
RCPDB::cornerRotations
std::vector< int > cornerRotations
Definition: RC.h:489
RC::cornerOrder
const int cornerOrder[4]
Definition: RC.h:266
RCPDB::GetCornerRotationHash
uint64_t GetCornerRotationHash(const RCState &s) const
Definition: RC.cpp:1930
Cubie::faceSize
const float faceSize
Definition: RC.h:43
RC::TestUpdate
void TestUpdate()
Definition: RC.cpp:1167
RC::GetActionHash
uint64_t GetActionHash(RCAction act) const
Definition: RC.h:411