14 #define POLYNOMIAL_RANK 0
105 inline int get(uint64_t state,
int whichLoc)
108 return (state>>((whichLoc<<2)))&0xF;
111 inline void set(uint64_t &state,
int whichLoc,
int cube)
113 const uint64_t blank = 0xF;
114 uint64_t value = cube;
115 state = state&(~(blank<<((whichLoc<<2))));
116 state |= (value<<((whichLoc<<2)));
119 inline void swap(uint64_t &state,
int loc1,
int loc2)
123 uint64_t val1 = (state>>(loc1));
124 uint64_t val2 = (state>>(loc2));
127 uint64_t xord = (val1 ^ val2)&0xF;
128 xord = (xord << loc1) | (xord << loc2);
144 for (
int x = 0; x < 8; x++)
152 assert(whichLoc < 8);
153 return (
state>>(16+4*whichLoc))&0xF;
157 assert(whichLoc < 8);
158 uint64_t blank = 0xF;
159 uint64_t value = cube&0xF;
161 state |= (value<<(16+4*whichLoc));
168 return (
state>>(2*whichLoc))&0x3;
175 uint64_t blank = 0x3;
176 uint64_t value = orient&0x3;
178 state |= (value<<(2*whichLoc));
182 assert(whichLoc < 8);
183 int cube = GetCubeInLoc(whichLoc/3);
184 int rot = (int)GetCubeOrientation(cube);
185 return cube*3+(3+(whichLoc%3)-rot)%3;
196 const uint64_t blank = 0xF;
201 (((
state>>a)&blank)<<b)|(((
state>>b)&blank)<<c)|
203 mask = (blank<<(a))|(blank<<(b))|(blank<<(c))|(blank<<(
d));
214 const uint64_t blank = 0xF;
219 (((
state>>a)&blank)<<b)|(((
state>>b)&blank)<<a)|
221 mask = (blank<<(a))|(blank<<(b))|(blank<<(c))|(blank<<(
d));
231 for (
int x = 8; x < 16; x++)
233 for (
int x = 0; x < 8; x++)
240 assert(whichLoc < 8);
241 return state[whichLoc];
245 assert(whichLoc < 8);
246 state[whichLoc] = cube;
252 return state[whichLoc+8];
258 state[whichLoc+8] = orient;
262 int cube = GetCubeInLoc(whichLoc/3);
263 int rot = (int)GetCubeOrientation(cube);
264 return cube*3+(3+(whichLoc%3)-rot)%3;
277 uint8_t tmp =
state[a];
292 for (
int x = 0; x < 18; x++)
295 neighbors.push_back(s);
302 for (
int x = 0; x < 18; x++)
304 actions.push_back(x);
483 return node.state == 0;
488 for (
int x = 0; x < 16; x++)
489 if (
node.state[x] != 0)
505 else if (1 == todo%3)
539 { 1ll, 1ll, 2ll, 6ll, 24ll, 120ll, 720ll, 5040ll, 40320ll, 362880ll, 3628800ll, 39916800ll, 479001600ll,
540 6227020800ll, 87178291200ll, 1307674368000ll, 20922789888000ll, 355687428096000ll,
541 6402373705728000ll, 121645100408832000ll, 2432902008176640000ll };
542 #if POLYNOMIAL_RANK == 1
545 for (
int x = 0; x < 8; x++)
546 puzzle[x] =
node.GetCubeInLoc(x);
548 uint64_t hashVal = 0;
550 int numEntriesLeft = 8;
551 for (
unsigned int x = 0; x < 8; x++)
553 hashVal += puzzle[x]*
Factorial[numEntriesLeft-1];
555 for (
unsigned y = x; y < 8; y++)
557 if (puzzle[y] > puzzle[x])
561 for (
int x = 2; x < 7; x++)
563 part2 = part2*3+
node.GetCubeOrientation(x);
568 uint64_t perm = 0, dual = 0;
569 for (
int x = 0; x < 8; x++)
571 set(perm, x,
node.GetCubeInLoc(x));
572 set(dual,
node.GetCubeInLoc(x), x);
575 uint64_t hashVal = 0;
576 for (
int x = 2; x < 7; x++)
578 hashVal = hashVal*3+
node.GetCubeOrientation(x);
589 { 1ll, 1ll, 2ll, 6ll, 24ll, 120ll, 720ll, 5040ll, 40320ll, 362880ll, 3628800ll, 39916800ll, 479001600ll,
590 6227020800ll, 87178291200ll, 1307674368000ll, 20922789888000ll, 355687428096000ll,
591 6402373705728000ll, 121645100408832000ll, 2432902008176640000ll };
593 #if POLYNOMIAL_RANK == 1
595 for (
int x = 0; x < 8; x++)
596 puzzle[x] =
node.GetCubeInLoc(x);
598 uint64_t hashVal = 0;
600 int numEntriesLeft = 8;
601 for (
unsigned int x = 0; x < 8; x++)
603 hashVal += puzzle[x]*
Factorial[numEntriesLeft-1];
605 for (
unsigned y = x; y < 8; y++)
607 if (puzzle[y] > puzzle[x])
611 for (
int x = 0; x < 7; x++)
613 part2 = part2*3+
node.GetCubeOrientation(x);
619 uint64_t perm = 0, dual = 0;
620 for (
int x = 0; x < 8; x++)
622 int val =
node.GetCubeInLoc(x);
627 uint64_t hashVal = 0;
628 for (
int x = 0; x < 7; x++)
630 hashVal = hashVal*3+
node.GetCubeOrientation(x);
646 for (
int i = n; i > 1; i--)
652 swap(perm, i-1,
get(dual, i-1));
657 for (
int i = (
int)ssLoc-1; i >= 0; i--)
673 { 1ll, 1ll, 2ll, 6ll, 24ll, 120ll, 720ll, 5040ll, 40320ll, 362880ll, 3628800ll, 39916800ll, 479001600ll,
674 6227020800ll, 87178291200ll, 1307674368000ll, 20922789888000ll, 355687428096000ll,
675 6402373705728000ll, 121645100408832000ll, 2432902008176640000ll };
676 #if POLYNOMIAL_RANK == 1
679 uint64_t hashVal = hash;
684 for (
int x = 6; x >= 0; x--)
686 node.SetCubeOrientation(x, hash%3);
690 node.SetCubeOrientation(7, (3-(cnt%3))%3);
692 int numEntriesLeft = 1;
693 for (
int x = 8-1; x >= 0; x--)
695 puzzle[x] = hashVal%numEntriesLeft;
696 hashVal /= numEntriesLeft;
698 for (
int y = x+1; y < 8; y++)
700 if (puzzle[y] >= puzzle[x])
704 for (
int x = 0; x < 8; x++)
705 node.SetCubeInLoc(x, puzzle[x]);
712 for (
int x = 6; x >= 0; x--)
718 node.SetCubeOrientation(7, (3-(cnt%3))%3);
721 for (
int x = 0; x < 8; x++)
724 for (
int x = 0; x < 8; x++)
726 node.SetCubeInLoc(x,
get(val, x));
733 for (
int i = n; i > 0; i--)
735 swap(perm, i-1, r%i);
768 const float scale = 0.3;
769 const float offset = 0.95*2.0*scale/3.0;
770 const float offset2 = 2.0*scale/3.0;
771 const float epsilon = 0.002;
778 glVertex3f(-scale, -scale, -scale+offset);
779 glVertex3f(-scale, -scale, -scale);
780 glVertex3f(-scale+offset, -scale, -scale);
781 glVertex3f(-scale+offset, -scale, -scale+offset);
784 glVertex3f(-scale, -scale+epsilon, -scale+offset2);
785 glVertex3f(-scale, -scale+epsilon, -scale);
786 glVertex3f(-scale+offset2, -scale+epsilon, -scale);
787 glVertex3f(-scale+offset2, -scale+epsilon, -scale+offset2);
791 glVertex3f(-scale, -scale+offset, -scale);
792 glVertex3f(-scale, -scale+offset, -scale+offset);
793 glVertex3f(-scale, -scale, -scale+offset);
794 glVertex3f(-scale, -scale, -scale);
797 glVertex3f(-scale+epsilon, -scale+offset2, -scale);
798 glVertex3f(-scale+epsilon, -scale+offset2, -scale+offset2);
799 glVertex3f(-scale+epsilon, -scale, -scale+offset2);
800 glVertex3f(-scale+epsilon, -scale, -scale);
804 glVertex3f(-scale, -scale+offset, -scale);
805 glVertex3f(-scale+offset, -scale+offset, -scale);
806 glVertex3f(-scale+offset, -scale, -scale);
807 glVertex3f(-scale, -scale, -scale);
810 glVertex3f(-scale, -scale+offset2, -scale+epsilon);
811 glVertex3f(-scale+offset2, -scale+offset2, -scale+epsilon);
812 glVertex3f(-scale+offset2, -scale, -scale+epsilon);
813 glVertex3f(-scale, -scale, -scale+epsilon);
820 glVertex3f(scale-offset, -scale, -scale+offset);
821 glVertex3f(scale-offset, -scale, -scale);
822 glVertex3f(scale, -scale, -scale);
823 glVertex3f(scale, -scale, -scale+offset);
826 glVertex3f(scale-offset2, -scale+epsilon, -scale+offset2);
827 glVertex3f(scale-offset2, -scale+epsilon, -scale);
828 glVertex3f(scale, -scale+epsilon, -scale);
829 glVertex3f(scale, -scale+epsilon, -scale+offset2);
833 glVertex3f(scale, -scale+offset, -scale);
834 glVertex3f(scale-offset, -scale+offset, -scale);
835 glVertex3f(scale-offset, -scale, -scale);
836 glVertex3f(scale, -scale, -scale);
839 glVertex3f(scale, -scale+offset2, -scale+epsilon);
840 glVertex3f(scale-offset2, -scale+offset2, -scale+epsilon);
841 glVertex3f(scale-offset2, -scale, -scale+epsilon);
842 glVertex3f(scale, -scale, -scale+epsilon);
846 glVertex3f(scale, -scale+offset, -scale);
847 glVertex3f(scale, -scale+offset, -scale+offset);
848 glVertex3f(scale, -scale, -scale+offset);
849 glVertex3f(scale, -scale, -scale);
852 glVertex3f(scale-epsilon, -scale+offset2, -scale);
853 glVertex3f(scale-epsilon, -scale+offset2, -scale+offset2);
854 glVertex3f(scale-epsilon, -scale, -scale+offset2);
855 glVertex3f(scale-epsilon, -scale, -scale);
861 glVertex3f(-scale, -scale, scale);
862 glVertex3f(-scale, -scale, scale-offset);
863 glVertex3f(-scale+offset, -scale, scale-offset);
864 glVertex3f(-scale+offset, -scale, scale);
867 glVertex3f(-scale, -scale+epsilon, scale);
868 glVertex3f(-scale, -scale+epsilon, scale-offset2);
869 glVertex3f(-scale+offset2, -scale+epsilon, scale-offset2);
870 glVertex3f(-scale+offset2, -scale+epsilon, scale);
875 glVertex3f(-scale, -scale+offset, scale);
876 glVertex3f(-scale, -scale+offset, scale-offset);
877 glVertex3f(-scale, -scale, scale-offset);
878 glVertex3f(-scale, -scale, scale);
881 glVertex3f(-scale+epsilon, -scale+offset2, scale);
882 glVertex3f(-scale+epsilon, -scale+offset2, scale-offset2);
883 glVertex3f(-scale+epsilon, -scale, scale-offset2);
884 glVertex3f(-scale+epsilon, -scale, scale);
888 glVertex3f(-scale, -scale+offset, scale);
889 glVertex3f(-scale+offset, -scale+offset, scale);
890 glVertex3f(-scale+offset, -scale, scale);
891 glVertex3f(-scale, -scale, scale);
894 glVertex3f(-scale, -scale+offset2, scale-epsilon);
895 glVertex3f(-scale+offset2, -scale+offset2, scale-epsilon);
896 glVertex3f(-scale+offset2, -scale, scale-epsilon);
897 glVertex3f(-scale, -scale, scale-epsilon);
904 glVertex3f(scale-offset, -scale, scale);
905 glVertex3f(scale-offset, -scale, scale-offset);
906 glVertex3f(scale, -scale, scale-offset);
907 glVertex3f(scale, -scale, scale);
910 glVertex3f(scale-offset2, -scale+epsilon, scale);
911 glVertex3f(scale-offset2, -scale+epsilon, scale-offset2);
912 glVertex3f(scale, -scale+epsilon, scale-offset2);
913 glVertex3f(scale, -scale+epsilon, scale);
917 glVertex3f(scale, -scale+offset, scale);
918 glVertex3f(scale, -scale+offset, scale-offset);
919 glVertex3f(scale, -scale, scale-offset);
920 glVertex3f(scale, -scale, scale);
923 glVertex3f(scale-epsilon, -scale+offset2, scale);
924 glVertex3f(scale-epsilon, -scale+offset2, scale-offset2);
925 glVertex3f(scale-epsilon, -scale, scale-offset2);
926 glVertex3f(scale-epsilon, -scale, scale);
931 glVertex3f(scale, -scale+offset, scale);
932 glVertex3f(scale-offset, -scale+offset, scale);
933 glVertex3f(scale-offset, -scale, scale);
934 glVertex3f(scale, -scale, scale);
937 glVertex3f(scale, -scale+offset2, scale-epsilon);
938 glVertex3f(scale-offset2, -scale+offset2, scale-epsilon);
939 glVertex3f(scale-offset2, -scale, scale-epsilon);
940 glVertex3f(scale, -scale, scale-epsilon);
947 glVertex3f(-scale, scale-offset, -scale);
948 glVertex3f(-scale, scale-offset, -scale+offset);
949 glVertex3f(-scale, scale, -scale+offset);
950 glVertex3f(-scale, scale, -scale);
953 glVertex3f(-scale+epsilon, scale-offset2, -scale);
954 glVertex3f(-scale+epsilon, scale-offset2, -scale+offset2);
955 glVertex3f(-scale+epsilon, scale, -scale+offset2);
956 glVertex3f(-scale+epsilon, scale, -scale);
961 glVertex3f(-scale, scale-offset, -scale);
962 glVertex3f(-scale+offset, scale-offset, -scale);
963 glVertex3f(-scale+offset, scale, -scale);
964 glVertex3f(-scale, scale, -scale);
967 glVertex3f(-scale, scale-offset2, -scale+epsilon);
968 glVertex3f(-scale+offset2, scale-offset2, -scale+epsilon);
969 glVertex3f(-scale+offset2, scale, -scale+epsilon);
970 glVertex3f(-scale, scale, -scale+epsilon);
975 glVertex3f(-scale, scale, -scale+offset);
976 glVertex3f(-scale, scale, -scale);
977 glVertex3f(-scale+offset, scale, -scale);
978 glVertex3f(-scale+offset, scale, -scale+offset);
981 glVertex3f(-scale, scale-epsilon, -scale+offset2);
982 glVertex3f(-scale, scale-epsilon, -scale);
983 glVertex3f(-scale+offset2, scale-epsilon, -scale);
984 glVertex3f(-scale+offset2, scale-epsilon, -scale+offset2);
991 glVertex3f(scale, scale-offset, -scale);
992 glVertex3f(scale-offset, scale-offset, -scale);
993 glVertex3f(scale-offset, scale, -scale);
994 glVertex3f(scale, scale, -scale);
997 glVertex3f(scale, scale-offset2, -scale+epsilon);
998 glVertex3f(scale-offset2, scale-offset2, -scale+epsilon);
999 glVertex3f(scale-offset2, scale, -scale+epsilon);
1000 glVertex3f(scale, scale, -scale+epsilon);
1004 glVertex3f(scale, scale-offset, -scale);
1005 glVertex3f(scale, scale-offset, -scale+offset);
1006 glVertex3f(scale, scale, -scale+offset);
1007 glVertex3f(scale, scale, -scale);
1010 glVertex3f(scale-epsilon, scale-offset2, -scale);
1011 glVertex3f(scale-epsilon, scale-offset2, -scale+offset2);
1012 glVertex3f(scale-epsilon, scale, -scale+offset2);
1013 glVertex3f(scale-epsilon, scale, -scale);
1017 glVertex3f(scale-offset, scale, -scale+offset);
1018 glVertex3f(scale-offset, scale, -scale);
1019 glVertex3f(scale, scale, -scale);
1020 glVertex3f(scale, scale, -scale+offset);
1023 glVertex3f(scale-offset2, scale-epsilon, -scale+offset2);
1024 glVertex3f(scale-offset2, scale-epsilon, -scale);
1025 glVertex3f(scale, scale-epsilon, -scale);
1026 glVertex3f(scale, scale-epsilon, -scale+offset2);
1032 glVertex3f(-scale, scale-offset, scale);
1033 glVertex3f(-scale, scale-offset, scale-offset);
1034 glVertex3f(-scale, scale, scale-offset);
1035 glVertex3f(-scale, scale, scale);
1038 glVertex3f(-scale+epsilon, scale-offset2, scale);
1039 glVertex3f(-scale+epsilon, scale-offset2, scale-offset2);
1040 glVertex3f(-scale+epsilon, scale, scale-offset2);
1041 glVertex3f(-scale+epsilon, scale, scale);
1046 glVertex3f(-scale, scale-offset, scale);
1047 glVertex3f(-scale+offset, scale-offset, scale);
1048 glVertex3f(-scale+offset, scale, scale);
1049 glVertex3f(-scale, scale, scale);
1052 glVertex3f(-scale, scale-offset2, scale-epsilon);
1053 glVertex3f(-scale+offset2, scale-offset2, scale-epsilon);
1054 glVertex3f(-scale+offset2, scale, scale-epsilon);
1055 glVertex3f(-scale, scale, scale-epsilon);
1060 glVertex3f(-scale, scale, scale);
1061 glVertex3f(-scale, scale, scale-offset);
1062 glVertex3f(-scale+offset, scale, scale-offset);
1063 glVertex3f(-scale+offset, scale, scale);
1066 glVertex3f(-scale, scale-epsilon, scale);
1067 glVertex3f(-scale, scale-epsilon, scale-offset2);
1068 glVertex3f(-scale+offset2, scale-epsilon, scale-offset2);
1069 glVertex3f(-scale+offset2, scale-epsilon, scale);
1075 glVertex3f(scale, scale-offset, scale);
1076 glVertex3f(scale, scale-offset, scale-offset);
1077 glVertex3f(scale, scale, scale-offset);
1078 glVertex3f(scale, scale, scale);
1081 glVertex3f(scale-epsilon, scale-offset2, scale);
1082 glVertex3f(scale-epsilon, scale-offset2, scale-offset2);
1083 glVertex3f(scale-epsilon, scale, scale-offset2);
1084 glVertex3f(scale-epsilon, scale, scale);
1089 glVertex3f(scale, scale-offset, scale);
1090 glVertex3f(scale-offset, scale-offset, scale);
1091 glVertex3f(scale-offset, scale, scale);
1092 glVertex3f(scale, scale, scale);
1095 glVertex3f(scale, scale-offset2, scale-epsilon);
1096 glVertex3f(scale-offset2, scale-offset2, scale-epsilon);
1097 glVertex3f(scale-offset2, scale, scale-epsilon);
1098 glVertex3f(scale, scale, scale-epsilon);
1103 glVertex3f(scale-offset, scale, scale);
1104 glVertex3f(scale-offset, scale, scale-offset);
1105 glVertex3f(scale, scale, scale-offset);
1106 glVertex3f(scale, scale, scale);
1109 glVertex3f(scale-offset2, scale-epsilon, scale);
1110 glVertex3f(scale-offset2, scale-epsilon, scale-offset2);
1111 glVertex3f(scale, scale-epsilon, scale-offset2);
1112 glVertex3f(scale, scale-epsilon, scale);
1135 glColor3f(0.0, 0.0, 0.0);
1142 case 0: theColor = 0;
break;
1143 case 1: theColor = 1;
break;
1144 case 2: theColor = 2;
break;
1145 case 3: theColor = 0;
break;
1146 case 4: theColor = 2;
break;
1147 case 5: theColor = 3;
break;
1148 case 6: theColor = 0;
break;
1149 case 7: theColor = 3;
break;
1150 case 8: theColor = 4;
break;
1151 case 9: theColor = 0;
break;
1152 case 10: theColor = 4;
break;
1153 case 11: theColor = 1;
break;
1154 case 12: theColor = 5;
break;
1155 case 13: theColor = 2;
break;
1156 case 14: theColor = 1;
break;
1157 case 15: theColor = 5;
break;
1158 case 16: theColor = 3;
break;
1159 case 17: theColor = 2;
break;
1160 case 18: theColor = 5;
break;
1161 case 19: theColor = 4;
break;
1162 case 20: theColor = 3;
break;
1163 case 21: theColor = 5;
break;
1164 case 22: theColor = 1;
break;
1165 case 23: theColor = 4;
break;
1166 default: theColor = -1;
break;
1171 case 0: glColor3f(1.0, 0.0, 0.0);
break;
1172 case 1: glColor3f(0.0, 1.0, 0.0);
break;
1173 case 2: glColor3f(0.0, 0.0, 1.0);
break;
1174 case 3: glColor3f(1.0, 1.0, 0.0);
break;
1175 case 4: glColor3f(1.0, 0.75, 0.0);
break;
1176 case 5: glColor3f(1.0, 1.0, 1.0);
break;
1177 default: glColor3f(0.0, 0.0, 0.0);
break;
1191 #pragma message("This code belongs in the RubikCorner, not in the PDB.")
1192 return 40320ll*2187ll;
1212 uint64_t answer[] = {1, 24, 504, 9072, 136080, 1632960, 14696640, 88179840, 88179840};
1213 return answer[
corners.size()];
1222 int puzzle[8] = {-1, -1, -1, -1, -1, -1, -1, -1};
1225 int cornerSize =
corners.size();
1226 int lastPiece = 8-(int)cornerSize;
1227 for (
int x = 0; x < 8; x++)
1229 for (
int x = 0; x < cornerSize; x++)
1231 newdual[x] = dual[
corners[x]];
1234 uint64_t hashVal = 0;
1236 hashVal =
mr1.
Rank(puzzle, newdual, cornerSize, 8);
1238 int limit =
std::min((
int)cornerSize, 7);
1239 for (
int x = 0; x < limit; x++)
1251 int cornerSize =
corners.size();
1252 int lastPiece = 8-(int)
corners.size();
1253 for (
int x = 0; x < 8; x++)
1255 for (
int x = 0; x < cornerSize; x++)
1258 uint64_t hashVal = 0;
1260 int numEntriesLeft = 8;
1261 for (
unsigned int x = 0; x < cornerSize; x++)
1266 for (
unsigned y = x; y < cornerSize; y++)
1268 if (puzzle[y] > puzzle[x])
1272 int limit =
std::min((
int)cornerSize, 7);
1273 for (
int x = 0; x < limit; x++)
1286 int lastPiece = 8-(int)
corners.size();
1287 int puzzle[8] = {-1, -1, -1, -1, -1, -1, -1};
1288 int dual[16] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
1289 uint64_t hashVal = hash;
1290 int cornerSize =
corners.size();
1293 mr1.
Unrank(hashVal, puzzle, dual, cornerSize, 8);
1295 for (
int x = 0; x < 8; x++)
1301 for (
int x = 0; x < cornerSize; x++)
1307 int limit =
std::min((
int)cornerSize, 7);
1308 for (
int x = limit-1; x >= 0; x--)
1314 if (cornerSize == 8)
1318 int lastPiece = 8-(int)
corners.size();
1319 int cornerSize =
corners.size();
1322 uint64_t hashVal = hash;
1326 int numEntriesLeft = lastPiece+1;
1327 for (
int x =
corners.size()-1; x >= 0; x--)
1329 puzzle[x] = hashVal%numEntriesLeft;
1330 hashVal /= numEntriesLeft;
1332 for (
int y = x+1; y < cornerSize; y++)
1334 if (puzzle[y] >= puzzle[x])
1338 for (
int x = 0; x < 8; x++)
1344 for (
int x = 0; x < cornerSize; x++)
1352 for (
int x = limit-1; x >= 0; x--)
1367 FILE *f = fopen(
GetFileName(prefix).c_str(),
"rb");
1370 perror(
"Opening RubiksCornerPDB file");
1380 FILE *f = fopen(
GetFileName(prefix).c_str(),
"w+");
1383 perror(
"Opening RubiksCornerPDB file");
1398 size_t edgeSize =
corners.size();
1399 if (fread(&edgeSize,
sizeof(edgeSize), 1, f) != 1)
1412 size_t edgeSize =
corners.size();
1413 fwrite(&edgeSize,
sizeof(edgeSize), 1, f);
1419 std::string fileName;
1420 fileName +=
"RC-C-";
1422 for (
int x = 0; x < 8; x++)
1424 fileName += std::to_string(
goalState[0].GetCubeInLoc(x));
1426 fileName += std::to_string(
goalState[0].GetCubeOrientation(
goalState[0].GetCubeInLoc(x)));
1429 fileName.pop_back();
1432 for (
size_t x = 0; x <
corners.size(); x++)
1434 fileName += std::to_string(
corners[x]);
1437 fileName.pop_back();
1441 if (std::is_same<RubiksCornerStateArray,RubiksCornerState>::value)
1452 static uint64_t table[21] =
1453 { 1ll, 1ll, 2ll, 6ll, 24ll, 120ll, 720ll, 5040ll, 40320ll, 362880ll, 3628800ll, 39916800ll, 479001600ll,
1454 6227020800ll, 87178291200ll, 1307674368000ll, 20922789888000ll, 355687428096000ll,
1455 6402373705728000ll, 121645100408832000ll, 2432902008176640000ll };
1457 return (uint64_t)-1;
1463 const uint64_t result[9][9] = {
1469 {120, 120, 60, 20, 5, 1},
1470 {720, 720, 360, 120, 30, 6, 1},
1471 {5040, 5040, 2520, 840, 210, 42, 7, 1},
1472 {40320, 40320, 20160, 6720, 1680, 336, 56, 8, 1},
1474 return result[n][k];