//PLL顶层排列调整(21种情况) public void PLL(Cube cube) { int flag = 0; while (!(cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.front[1, 1] && cube.front[0, 2] == cube.front[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[1, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.right[1, 1] && cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.left[1, 1])) { //PLL1 if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[1, 0] == cube.left[1, 1] && cube.right[2, 0] == cube.right[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.right[1, 1] && cube.front[0, 2] == cube.front[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.front[1, 1] && cube.left[2, 2] == cube.left[1, 1]) { cube.R(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 2); } //PLL2 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[1, 0] == cube.front[1, 1] && cube.right[2, 0] == cube.right[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.left[1, 1] && cube.front[0, 2] == cube.front[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.right[1, 1] && cube.left[2, 2] == cube.left[1, 1]) { cube.R(cube, 2); cube.U(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.U(cube, 1); cube.r(cube, 1); } //PLL3 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.right[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 2] == cube.front[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.left[1, 1] && cube.right[1, 0] == cube.left[1, 1] && cube.front[0, 1] == cube.back[1, 1] && cube.left[1, 2] == cube.right[1, 1] && cube.back[2, 1] == cube.front[1, 1]) { cube.R(cube, 2); cube.L(cube, 2); cube.D(cube, 1); cube.R(cube, 2); cube.L(cube, 2); cube.D(cube, 2); cube.R(cube, 2); cube.L(cube, 2); cube.D(cube, 1); cube.R(cube, 2); cube.L(cube, 2); } //PLL4 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.right[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 2] == cube.front[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.left[1, 1] && cube.right[1, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.right[1, 1] && cube.left[1, 2] == cube.back[1, 1] && cube.back[2, 1] == cube.left[1, 1]) { cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.R(cube, 2); cube.u(cube, 1); cube.r(cube, 1); cube.U(cube, 1); } //PLL5 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.right[1, 1] && cube.right[0, 0] == cube.front[1, 1] && cube.right[1, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.front[1, 1] && cube.front[0, 0] == cube.back[1, 1] && cube.front[0, 1] == cube.front[1, 1] && cube.front[0, 2] == cube.left[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.right[1, 1]) { cube.R(cube, 2); cube.F(cube, 2); cube.r(cube, 1); cube.b(cube, 1); cube.R(cube, 1); cube.F(cube, 2); cube.r(cube, 1); cube.B(cube, 1); cube.r(cube, 1); } //PLL6 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.front[1, 1] && cube.right[0, 0] == cube.left[1, 1] && cube.right[1, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.back[1, 1] && cube.front[0, 0] == cube.right[1, 1] && cube.front[0, 1] == cube.front[1, 1] && cube.front[0, 2] == cube.right[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.front[1, 1]) { cube.R(cube, 1); cube.b(cube, 1); cube.R(cube, 1); cube.F(cube, 2); cube.r(cube, 1); cube.B(cube, 1); cube.R(cube, 1); cube.F(cube, 2); cube.R(cube, 2); } //PLL7 else if (cube.back[2, 0] == cube.left[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.right[1, 1] && cube.right[0, 0] == cube.front[1, 1] && cube.right[1, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.back[1, 1] && cube.front[0, 0] == cube.left[1, 1] && cube.front[0, 1] == cube.front[1, 1] && cube.front[0, 2] == cube.right[1, 1] && cube.left[0, 2] == cube.front[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.back[1, 1]) { cube.R(cube, 1); cube.b(cube, 1); cube.r(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.B(cube, 1); cube.r(cube, 1); cube.F(cube, 2); cube.l(cube, 1); cube.B(cube, 1); cube.L(cube, 1); cube.F(cube, 1); cube.l(cube, 1); cube.b(cube, 1); cube.L(cube, 1); } //PLL8 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.right[1, 1] && cube.right[0, 0] == cube.front[1, 1] && cube.right[1, 0] == cube.left[1, 1] && cube.right[2, 0] == cube.back[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.front[1, 1] && cube.front[0, 2] == cube.right[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.right[1, 1] && cube.left[2, 2] == cube.left[1, 1]) { cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.F(cube, 1); cube.R(cube, 2); cube.u(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.f(cube, 1); } //PLL9 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.front[1, 1] && cube.back[2, 2] == cube.right[1, 1] && cube.right[0, 0] == cube.front[1, 1] && cube.right[1, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.back[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.back[1, 1] && cube.front[0, 2] == cube.right[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.left[1, 1]) { cube.u(cube, 1); cube.r(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.R(cube, 2); cube.f(cube, 1); cube.u(cube, 1); cube.F(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.F(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.R(cube, 2); } //PLL10 else if (cube.back[2, 0] == cube.front[1, 1] && cube.back[2, 1] == cube.right[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[1, 0] == cube.back[1, 1] && cube.right[2, 0] == cube.left[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.front[1, 1] && cube.front[0, 2] == cube.back[1, 1] && cube.left[0, 2] == cube.right[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.left[1, 1]) { cube.r(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.b(cube, 1); cube.D(cube, 1); cube.b(cube, 1); cube.d(cube, 1); cube.B(cube, 2); cube.r(cube, 1); cube.b(cube, 1); cube.R(cube, 1); cube.B(cube, 1); cube.R(cube, 1); } //PLL11 else if (cube.back[2, 0] == cube.front[1, 1] && cube.back[2, 1] == cube.left[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[1, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.left[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.front[1, 1] && cube.front[0, 2] == cube.back[1, 1] && cube.left[0, 2] == cube.right[1, 1] && cube.left[1, 2] == cube.back[1, 1] && cube.left[2, 2] == cube.left[1, 1]) { cube.F(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); } //PLL12 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[1, 0] == cube.front[1, 1] && cube.right[2, 0] == cube.front[1, 1] && cube.front[0, 0] == cube.right[1, 1] && cube.front[0, 1] == cube.right[1, 1] && cube.front[0, 2] == cube.left[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.front[1, 1]) { cube.l(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.U(cube, 2); cube.L(cube, 1); cube.u(cube, 1); cube.l(cube, 1); cube.U(cube, 2); cube.L(cube, 1); cube.R(cube, 1); cube.u(cube, 1); } //PLL13 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.right[1, 1] && cube.right[0, 0] == cube.front[1, 1] && cube.right[1, 0] == cube.front[1, 1] && cube.right[2, 0] == cube.back[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.right[1, 1] && cube.front[0, 2] == cube.right[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.left[1, 1]) { cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.F(cube, 1); cube.R(cube, 2); cube.u(cube, 1); cube.r(cube, 1); cube.u(cube, 1); } //PLL14 else if (cube.back[2, 0] == cube.right[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.left[1, 1] && cube.right[0, 0] == cube.back[1, 1] && cube.right[1, 0] == cube.front[1, 1] && cube.right[2, 0] == cube.right[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.right[1, 1] && cube.front[0, 2] == cube.front[1, 1] && cube.left[0, 2] == cube.back[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.left[1, 1]) { cube.r(cube, 1); cube.U(cube, 2); cube.R(cube, 1); cube.U(cube, 2); cube.r(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.R(cube, 2); cube.u(cube, 1); } //PLL15 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.right[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[1, 0] == cube.back[1, 1] && cube.right[2, 0] == cube.front[1, 1] && cube.front[0, 0] == cube.right[1, 1] && cube.front[0, 1] == cube.front[1, 1] && cube.front[0, 2] == cube.left[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.front[1, 1]) { cube.R(cube, 1); cube.U(cube, 2); cube.r(cube, 1); cube.U(cube, 2); cube.R(cube, 1); cube.b(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.B(cube, 1); cube.R(cube, 2); cube.U(cube, 1); } //PLL16 else if (cube.back[2, 0] == cube.left[1, 1] && cube.back[2, 1] == cube.back[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[1, 0] == cube.front[1, 1] && cube.right[2, 0] == cube.left[1, 1] && cube.front[0, 0] == cube.right[1, 1] && cube.front[0, 1] == cube.left[1, 1] && cube.front[0, 2] == cube.back[1, 1] && cube.left[0, 2] == cube.front[1, 1] && cube.left[1, 2] == cube.right[1, 1] && cube.left[2, 2] == cube.front[1, 1]) { cube.R(cube, 2); cube.d(cube, 1); cube.F(cube, 1); cube.u(cube, 1); cube.F(cube, 1); cube.U(cube, 1); cube.f(cube, 1); cube.D(cube, 1); cube.R(cube, 2); cube.B(cube, 1); cube.u(cube, 1); cube.b(cube, 1); } //PLL17 else if (cube.back[2, 0] == cube.right[1, 1] && cube.back[2, 1] == cube.left[1, 1] && cube.back[2, 2] == cube.front[1, 1] && cube.right[0, 0] == cube.left[1, 1] && cube.right[1, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.right[1, 1] && cube.front[0, 0] == cube.left[1, 1] && cube.front[0, 1] == cube.back[1, 1] && cube.front[0, 2] == cube.front[1, 1] && cube.left[0, 2] == cube.back[1, 1] && cube.left[1, 2] == cube.front[1, 1] && cube.left[2, 2] == cube.back[1, 1]) { cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.F(cube, 2); cube.d(cube, 1); cube.L(cube, 1); cube.u(cube, 1); cube.l(cube, 1); cube.U(cube, 1); cube.l(cube, 1); cube.D(cube, 1); cube.F(cube, 2); } //PLL18 else if (cube.back[2, 0] == cube.right[1, 1] && cube.back[2, 1] == cube.left[1, 1] && cube.back[2, 2] == cube.front[1, 1] && cube.right[0, 0] == cube.left[1, 1] && cube.right[1, 0] == cube.back[1, 1] && cube.right[2, 0] == cube.right[1, 1] && cube.front[0, 0] == cube.left[1, 1] && cube.front[0, 1] == cube.front[1, 1] && cube.front[0, 2] == cube.front[1, 1] && cube.left[0, 2] == cube.back[1, 1] && cube.left[1, 2] == cube.right[1, 1] && cube.left[2, 2] == cube.back[1, 1]) { cube.R(cube, 2); cube.D(cube, 1); cube.b(cube, 1); cube.U(cube, 1); cube.b(cube, 1); cube.u(cube, 1); cube.B(cube, 1); cube.d(cube, 1); cube.R(cube, 2); cube.f(cube, 1); cube.U(cube, 1); cube.F(cube, 1); } //PLL19 else if (cube.back[2, 0] == cube.right[1, 1] && cube.back[2, 1] == cube.front[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[1, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.left[1, 1] && cube.front[0, 0] == cube.right[1, 1] && cube.front[0, 1] == cube.left[1, 1] && cube.front[0, 2] == cube.back[1, 1] && cube.left[0, 2] == cube.front[1, 1] && cube.left[1, 2] == cube.back[1, 1] && cube.left[2, 2] == cube.front[1, 1]) { cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.B(cube, 2); cube.D(cube, 1); cube.l(cube, 1); cube.u(cube, 1); cube.L(cube, 1); cube.u(cube, 1); cube.L(cube, 1); cube.d(cube, 1); cube.B(cube, 2); } //PLL20 else if (cube.back[2, 0] == cube.front[1, 1] && cube.back[2, 1] == cube.front[1, 1] && cube.back[2, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1] && cube.right[1, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.left[1, 1] && cube.front[0, 0] == cube.front[1, 1] && cube.front[0, 1] == cube.back[1, 1] && cube.front[0, 2] == cube.back[1, 1] && cube.left[0, 2] == cube.right[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.left[1, 1]) { cube.u(cube, 1); cube.L(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(cube, 2); cube.l(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.L(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(cube, 2); cube.l(cube, 1); cube.U(cube, 1); cube.r(cube, 1); } //PLL21 else if (cube.back[2, 0] == cube.back[1, 1] && cube.back[2, 1] == cube.front[1, 1] && cube.back[2, 2] == cube.front[1, 1] && cube.right[0, 0] == cube.left[1, 1] && cube.right[1, 0] == cube.right[1, 1] && cube.right[2, 0] == cube.right[1, 1] && cube.front[0, 0] == cube.back[1, 1] && cube.front[0, 1] == cube.back[1, 1] && cube.front[0, 2] == cube.front[1, 1] && cube.left[0, 2] == cube.left[1, 1] && cube.left[1, 2] == cube.left[1, 1] && cube.left[2, 2] == cube.right[1, 1]) { cube.l(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.U(cube, 2); cube.L(cube, 1); cube.u(cube, 1); cube.l(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.U(cube, 2); cube.L(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.u(cube, 1); } else { if (flag < 4) { cube.U(cube, 1); flag++; } else { count -= 4; cube.Y(cube, 1); flag = 0; } } } }