bool SolveBottomMiddlePositions(ref List <string> path) { List <CubeInfo.Cubie> bottom = _cubies.FindBottomMiddle(); bool sorted = _cubies.BottomMiddlesCorrectPositions(); if (sorted) { return(true); // no work to do } FocusCubie(new Vector3(-1, -2, -1)); for (int i = 0; i < _cubies.GetNumCubes(); i++) { if (!_cubies.IsCenterCube(i)) { _cubies.EnableColor(_cubies.GetCubeInfo(i), false); } } foreach (CubeInfo.Cubie c in bottom) { _cubies.EnableColor(c, true); } // case 1: need to rotate three // case 2: need to swap consecutive cubies // case 3: need to swap opposite cubies ArrayList steps = new ArrayList(); string[] sequences = { //rotate C "F2 D L' R F2 L R' D F2", "L2 D B' F L2 B F' D L2", "B2 D R' L B2 R L' D B2", "R2 D F' B R2 F B' D R2", //rotate CC "F2 D' L' R F2 L R' D' F2", "L2 D' B' F L2 B F' D' L2", "B2 D' R' L B2 R L' D' B2", "R2 D' F' B R2 F B' D' R2", //swap opposite "R2 L2 U R2 L2 D2 R2 L2 U R2 L2", "R F D F' D' R2 B' D' B D R", //swap neighbors "R F D F' D' R2 B' D' B D R", "B R D R' D' B2 L' D' L D B" }; // ASN TODO: We know the sequence if we analyze the cube more closely foreach (string seqn in sequences) { steps.Clear(); string[] words = seqn.Split(); foreach (string word in words) { string[] tmp = { word }; steps.Add(tmp); } path = _solver.Search(null, _solved, steps, _solver.ScorePositions); if (path.Count > 0) { break; } } return(path.Count > 0); }