public bool Init3() { c2.Copy(c1); for (int i = 0; i < Length2; i++) { c2.Move(move2[i]); } if (!c2.CheckEdge()) { return(false); } int eparity = e12.Set(c2.GetEdge()); ct3.Set(c2.GetCenter(), eparity ^ c2.GetCorner().GetParity()); int ct = ct3.Getct(); _ = e12.Get(10); int prun = Edge3.Getprun(e12.Getsym()); if (arr2[arr2idx] == null) { arr2[arr2idx] = new FullCube(c2); } else { arr2[arr2idx].Copy(c2); } arr2[arr2idx].value = Length1 + Length2 + Math.Max(prun, Center3.prun[ct]); arr2[arr2idx].Length2 = Length2; arr2idx++; return(arr2idx == arr2.Length); }
public void DoSearch() { solution = ""; int ud = new Center1(c.GetCenter(), 0).Getsym(); int fb = new Center1(c.GetCenter(), 1).Getsym(); int rl = new Center1(c.GetCenter(), 2).Getsym(); int udprun = csprun[ud >> 6]; int fbprun = csprun[fb >> 6]; int rlprun = csprun[rl >> 6]; p1SolsCnt = 0; arr2idx = 0; p1sols.Clear(); for (Length1 = Math.Min(Math.Min(udprun, fbprun), rlprun); Length1 < 100; Length1++) { if (rlprun <= Length1 && Search1(rl >> 6, rl & 0x3f, Length1, -1, 0) || //> udprun <= Length1 && Search1(ud >> 6, ud & 0x3f, Length1, -1, 0) || //> fbprun <= Length1 && Search1(fb >> 6, fb & 0x3f, Length1, -1, 0)) //> { break; } } FullCube[] p1SolsArr = p1sols.ToArray(); Array.Sort(p1SolsArr);//, 0, p1SolsArr.Length int MAX_Length2 = 9; int Length12; do { bool out1 = false; for (Length12 = p1SolsArr[0].value; Length12 < 100; Length12++) { for (int i = 0; i < p1SolsArr.Length; i++) { if (p1SolsArr[i].value > Length12) { break; } if (Length12 - p1SolsArr[i].Length1 > MAX_Length2) { continue; } c1.Copy(p1SolsArr[i]); ct2.Set(c1.GetCenter(), c1.GetEdge().GetParity()); int s2ct = ct2.Getct(); int s2rl = ct2.Getrl(); Length1 = p1SolsArr[i].Length1; Length2 = Length12 - p1SolsArr[i].Length1; if (Search2(s2ct, s2rl, Length2, 28, 0)) { out1 = true; break; } } if (out1) { break; } } MAX_Length2++; } while (Length12 == 100); Array.Sort(arr2);//, 0, arr2idx int Length123, index = 0; int solcnt = 0; int MAX_Length3 = 13; do { bool out2 = false; for (Length123 = arr2[0].value; Length123 < 100; Length123++) { for (int i = 0; i < Math.Min(arr2idx, PHASE3_ATTEMPTS); i++) { if (arr2[i].value > Length123) { break; } if (Length123 - arr2[i].Length1 - arr2[i].Length2 > MAX_Length3) { continue; } int eparity = e12.Set(arr2[i].GetEdge()); ct3.Set(arr2[i].GetCenter(), eparity ^ arr2[i].GetCorner().GetParity()); int ct = ct3.Getct(); int edge = e12.Get(10); int prun = Edge3.Getprun(e12.Getsym()); int lm = 20; if (prun <= Length123 - arr2[i].Length1 - arr2[i].Length2 && Search3(edge, ct, prun, Length123 - arr2[i].Length1 - arr2[i].Length2, lm, 0)) { solcnt++; // if (solcnt == 5) { index = i; out2 = true; break; // } } } if (out2) { break; } } MAX_Length3++; } while (Length123 == 100); FullCube solcube = new FullCube(arr2[index]); Length1 = solcube.Length1; Length2 = solcube.Length2; int Length = Length123 - Length1 - Length2; for (int i = 0; i < Length; i++) { solcube.Move(move3std[move3[i]]); } string facelet = solcube.To333Facelet(); string sol = search333.Solution(facelet, 21, 1000000, 500, 0); int len333 = search333.Length; if (sol.StartsWith("Error")) { //System.out.println(sol); //System.out.println(solcube); //System.out.println(facelet); throw new Exception(); } int[] sol333 = Tomove(sol); for (int i = 0; i < sol333.Length; i++) { solcube.Move(sol333[i]); } solution = solcube.GetMovestring(inverse_solution, with_rotation); totlen = Length1 + Length2 + Length + len333; }