int Solver::Solve2(KociembaCube& cube) { int iteration = 1; int result = NOT_FOUND; // Establish initial cost estimate to goal state threshold2 = Phase2Cost( cube.CornerPermutation(), cube.NonMiddleSliceEdgePermutation(), cube.MiddleSliceEdgePermutation()); nodes2 = 1; // Count root node here solutionLength2 = 0; do { newThreshold2 = Huge; // Any cost will be less than this // Perform the phase 2 recursive IDA* search result = Search2( cube.CornerPermutation(), cube.NonMiddleSliceEdgePermutation(), cube.MiddleSliceEdgePermutation(), 0); // Establish a new threshold for a deeper search threshold2 = newThreshold2; // Count interative deepenings iteration++; } while (result == NOT_FOUND); // cout << "Phase 2 nodes = " << nodes2 << endl; return result; }
int Solver::Solve2(KociembaCube& cube) { int iteration = 1; int result = NOT_FOUND; threshold2 = Phase2Cost( cube.CornerPermutation(), cube.NonMiddleSliceEdgePermutation(), cube.MiddleSliceEdgePermutation()); nodes++; nodes2 = 1; solutionLength2 = 0; do { newThreshold2 = Huge; result = Search2( cube.CornerPermutation(), cube.NonMiddleSliceEdgePermutation(), cube.MiddleSliceEdgePermutation(), 0); threshold2 = newThreshold2; iteration++; } while (result == NOT_FOUND); Application->processEvents(); return result; }