18 for (
int x = 0; x < 18; x++)
27 for (
int x = 0; x < 18; x++)
30 if (x/3 == lastAction/3)
34 if ((1 == (lastAction/3)%2) &&
35 (x/3+1 == lastAction/3))
48 for (
int x = 0; x < 18; x++)
54 for (
int x = 0; x < 18; x++)
61 if ((1 == (
history.back()/3)%2) &&
76 for (
int x = 0; x < 18; x++)
155 return HCost(node1, node2);
481 float offset = 0.95*scale/3.0;
487 glVertex3f(-3.0*offset, -scale, -3.0*offset);
488 glVertex3f(3.0*offset, -scale, -3.0*offset);
489 glVertex3f(3.0*offset, -scale, 3.0*offset);
490 glVertex3f(-3.0*offset, -scale, 3.0*offset);
492 glVertex3f(-3.0*offset, scale, -3.0*offset);
493 glVertex3f(3.0*offset, scale, -3.0*offset);
494 glVertex3f(3.0*offset, scale, 3.0*offset);
495 glVertex3f(-3.0*offset, scale, 3.0*offset);
497 glVertex3f(-scale, -3.0*offset, -3.0*offset);
498 glVertex3f(-scale, 3.0*offset, -3.0*offset);
499 glVertex3f(-scale, 3.0*offset, 3.0*offset);
500 glVertex3f(-scale, -3.0*offset, 3.0*offset);
503 glVertex3f(scale, -3.0*offset, -3.0*offset);
504 glVertex3f(scale, 3.0*offset, -3.0*offset);
505 glVertex3f(scale, 3.0*offset, 3.0*offset);
506 glVertex3f(scale, -3.0*offset, 3.0*offset);
509 glVertex3f(-3.0*offset, -3.0*offset, -scale);
510 glVertex3f(3.0*offset, -3.0*offset, -scale);
511 glVertex3f(3.0*offset, 3.0*offset, -scale);
512 glVertex3f(-3.0*offset, 3.0*offset, -scale);
515 glVertex3f(-3.0*offset, -3.0*offset, scale);
516 glVertex3f(3.0*offset, -3.0*offset, scale);
517 glVertex3f(3.0*offset, 3.0*offset, scale);
518 glVertex3f(-3.0*offset, 3.0*offset, scale);
537 float offset = 0.95*scale/3.0;
538 const float offset2 = scale/3.0;
539 const float epsilon = 0.002;
546 glVertex3f(-offset, -scale, -offset);
547 glVertex3f(offset, -scale, -offset);
548 glVertex3f(offset, -scale, offset);
549 glVertex3f(-offset, -scale, offset);
552 glVertex3f(-offset2, -scale+epsilon, -offset2);
553 glVertex3f(offset2, -scale+epsilon, -offset2);
554 glVertex3f(offset2, -scale+epsilon, offset2);
555 glVertex3f(-offset2, -scale+epsilon, offset2);
561 glVertex3f(-offset, scale, -offset);
562 glVertex3f(offset, scale, -offset);
563 glVertex3f(offset, scale, offset);
564 glVertex3f(-offset, scale, offset);
567 glVertex3f(-offset2, scale-epsilon, -offset2);
568 glVertex3f(offset2, scale-epsilon, -offset2);
569 glVertex3f(offset2, scale-epsilon, offset2);
570 glVertex3f(-offset2, scale-epsilon, offset2);
575 glVertex3f(-scale, -offset, -offset);
576 glVertex3f(-scale, offset, -offset);
577 glVertex3f(-scale, offset, offset);
578 glVertex3f(-scale, -offset, offset);
581 glVertex3f(-scale+epsilon, -offset2, -offset2);
582 glVertex3f(-scale+epsilon, offset2, -offset2);
583 glVertex3f(-scale+epsilon, offset2, offset2);
584 glVertex3f(-scale+epsilon, -offset2, offset2);
590 glVertex3f(-offset, -offset, scale);
591 glVertex3f(offset, -offset, scale);
592 glVertex3f(offset, offset, scale);
593 glVertex3f(-offset, offset, scale);
596 glVertex3f(-offset2, -offset2, scale-epsilon);
597 glVertex3f(offset2, -offset2, scale-epsilon);
598 glVertex3f(offset2, offset2, scale-epsilon);
599 glVertex3f(-offset2, offset2, scale-epsilon);
605 glVertex3f(-offset, -offset, -scale);
606 glVertex3f(offset, -offset, -scale);
607 glVertex3f(offset, offset, -scale);
608 glVertex3f(-offset, offset, -scale);
611 glVertex3f(-offset2, -offset2, -scale+epsilon);
612 glVertex3f(offset2, -offset2, -scale+epsilon);
613 glVertex3f(offset2, offset2, -scale+epsilon);
614 glVertex3f(-offset2, offset2, -scale+epsilon);
619 glVertex3f(scale, -offset, -offset);
620 glVertex3f(scale, offset, -offset);
621 glVertex3f(scale, offset, offset);
622 glVertex3f(scale, -offset, offset);
625 glVertex3f(scale-epsilon, -offset2, -offset2);
626 glVertex3f(scale-epsilon, offset2, -offset2);
627 glVertex3f(scale-epsilon, offset2, offset2);
628 glVertex3f(scale-epsilon, -offset2, offset2);
637 case -1: glColor3f(0.0, 0.0, 0.0);
break;
638 case 0: glColor3f(1.0, 0.0, 0.0);
break;
639 case 1: glColor3f(0.0, 1.0, 0.0);
break;
640 case 2: glColor3f(0.0, 0.0, 1.0);
break;
641 case 3: glColor3f(1.0, 1.0, 0.0);
break;
642 case 4: glColor3f(1.0, 0.75, 0.0);
break;
643 case 5: glColor3f(1.0, 1.0, 1.0);
break;
644 default: assert(
false);
654 int vals[3] = {-90, 90, 180};
661 glRotatef(vals[a%3]*t, 0, 1, 0);
663 for (
int x = 0; x < 9; x++)
673 for (
int x = 9; x < 27; x++)
684 glRotatef(vals[a%3]*t, 0, 1, 0);
686 for (
int x = 18; x < 27; x++)
696 for (
int x = 0; x < 18; x++)
706 int which[9] = {0, 1, 2, 9, 10, 11, 18, 19, 20};
707 int others[18] = {3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17, 21, 22, 23, 24, 25, 26};
709 glRotatef(vals[a%3]*t, 0, 0, -1);
711 for (
int x = 0; x < 9; x++)
721 for (
int x = 0; x < 18; x++)
731 int which[9] = {6, 7, 8, 15, 16, 17, 24, 25, 26};
732 int others[18] = {3, 4, 5, 0, 1, 2, 12, 13, 14, 9, 10, 11, 21, 22, 23, 18, 19, 20};
734 glRotatef(vals[a%3]*t, 0, 0, 1);
736 for (
int x = 0; x < 9; x++)
746 for (
int x = 0; x < 18; x++)
756 int which[9] = {0, 3, 6, 9, 12, 15, 18, 21, 24};
757 int others[18] = {1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26};
759 glRotatef(vals[a%3]*t, -1, 0, 0);
761 for (
int x = 0; x < 9; x++)
771 for (
int x = 0; x < 18; x++)
782 int which[9] = {2, 5, 8, 11, 14, 17, 20, 23, 26};
783 int others[18] = {0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16, 18, 19, 21, 22, 24, 25};
785 glRotatef(vals[a%3]*t, 1, 0, 0);
787 for (
int x = 0; x < 9; x++)
797 for (
int x = 0; x < 18; x++)
825 :
PDBHeuristic(e), ePDB(&e->e, s.
edge, distinctEdges), cPDB(&e->c, s.corner, distinctCorners), edges(distinctEdges), corners(distinctCorners)
873 FILE *f = fopen(
GetFileName(prefix).c_str(),
"rb");
876 std::cout <<
"Could not load PDB: " <<
GetFileName(prefix) <<
"\n";
879 bool result =
Load(f);
882 std::cout <<
"Successfully loaded PDB: " <<
GetFileName(prefix) <<
"\n";
884 std::cout <<
"Could not load PDB: " <<
GetFileName(prefix) <<
"\n";
890 FILE *f = fopen(
GetFileName(prefix).c_str(),
"w+b");
893 std::cout <<
"Saved PDB: " <<
GetFileName(prefix) <<
"\n";
899 if (fread(&numEdges,
sizeof(numEdges), 1, f) != 1)
901 edges.resize(numEdges);
905 if (fread(&numCorners,
sizeof(numCorners), 1, f) != 1)
921 size_t numEdges =
edges.size();
922 fwrite(&numEdges,
sizeof(numEdges), 1, f);
924 size_t numCorners =
corners.size();
925 fwrite(&numCorners,
sizeof(numCorners), 1, f);
934 std::string fileName;
937 if (fileName.back() !=
'/' && prefix[0] != 0)
941 for (
int x = 0; x < 4; x++)
1011 for (
int x = 0; x < 8; x++)
1016 for (
int x = 0; x < 12; x++)
1044 for (
int x = 0; x < 8; x++)
1049 for (
int x = 0; x < 8; x++)
1055 for (
int x = 0; x < 12; x++)
1060 for (
int x = 0; x < 12; x++)