//前面一层顺时针转动 public void F(Cube cube, int n) { char t1, t2, t3; for (int i = 0; i < n; i++) { t1 = cube.up[2, 0]; t2 = cube.up[2, 1]; t3 = cube.up[2, 2]; cube.up[2, 0] = cube.left[2, 0]; cube.up[2, 1] = cube.left[2, 1]; cube.up[2, 2] = cube.left[2, 2]; cube.left[2, 0] = cube.down[2, 0]; cube.left[2, 1] = cube.down[2, 1]; cube.left[2, 2] = cube.down[2, 2]; cube.down[2, 0] = cube.right[2, 0]; cube.down[2, 1] = cube.right[2, 1]; cube.down[2, 2] = cube.right[2, 2]; cube.right[2, 0] = t1; cube.right[2, 1] = t2; cube.right[2, 2] = t3; Rotate(cube.front); sequence[count] = 'F'; count++; } }
//x轴顺时针转动魔方 public void Y(Cube cube, int n) { char[,] surface = new char[3, 3]; surface = cube.front; Rotate(cube.right); cube.front = cube.right; Rotate(cube.back); cube.right = cube.back; Rotate(cube.left); cube.back = cube.left; Rotate(surface); cube.left = surface; Rotate(cube.up); rotate(cube.down); sequence[count] = 'Y'; count++; }
private void btn_ok_Click(object sender, EventArgs e) { Cube mycube = new Cube(); mycube.front[0, 0] = 'r'; mycube.front[0, 1] = 'r'; mycube.front[0, 2] = 'r'; mycube.front[1, 0] = 'r'; mycube.front[1, 1] = 'r'; mycube.front[1, 2] = 'r'; mycube.front[2, 0] = 'r'; mycube.front[2, 1] = 'r'; mycube.front[2, 2] = 'r'; mycube.back[0, 0] = 'o'; mycube.back[0, 1] = 'o'; mycube.back[0, 2] = 'o'; mycube.back[1, 0] = 'o'; mycube.back[1, 1] = 'o'; mycube.back[1, 2] = 'o'; mycube.back[2, 0] = 'o'; mycube.back[2, 1] = 'o'; mycube.back[2, 2] = 'o'; mycube.left[0, 0] = 'b'; mycube.left[0, 1] = 'b'; mycube.left[0, 2] = 'b'; mycube.left[1, 0] = 'b'; mycube.left[1, 1] = 'b'; mycube.left[1, 2] = 'b'; mycube.left[2, 0] = 'b'; mycube.left[2, 1] = 'b'; mycube.left[2, 2] = 'b'; mycube.right[0, 0] = 'g'; mycube.right[0, 1] = 'g'; mycube.right[0, 2] = 'g'; mycube.right[1, 0] = 'g'; mycube.right[1, 1] = 'g'; mycube.right[1, 2] = 'g'; mycube.right[2, 0] = 'g'; mycube.right[2, 1] = 'g'; mycube.right[2, 2] = 'g'; mycube.up[0, 0] = 'y'; mycube.up[0, 1] = 'y'; mycube.up[0, 2] = 'y'; mycube.up[1, 0] = 'y'; mycube.up[1, 1] = 'y'; mycube.up[1, 2] = 'y'; mycube.up[2, 0] = 'y'; mycube.up[2, 1] = 'y'; mycube.up[2, 2] = 'y'; mycube.down[0, 0] = 'w'; mycube.down[0, 1] = 'w'; mycube.down[0, 2] = 'w'; mycube.down[1, 0] = 'w'; mycube.down[1, 1] = 'w'; mycube.down[1, 2] = 'w'; mycube.down[2, 0] = 'w'; mycube.down[2, 1] = 'w'; mycube.down[2, 2] = 'w'; //按空格分隔公式,并删除多余空格 string[] exp = txt_upset.Text.Trim().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < exp.Length; i++) { if (exp[i] == "F") mycube.F(mycube, 1); else if (exp[i] == "F2") mycube.F(mycube, 2); else if (exp[i] == "F'") mycube.f(mycube, 1); else if (exp[i] == "F2'") mycube.f(mycube, 2); else if (exp[i] == "B") mycube.B(mycube, 1); else if (exp[i] == "B2") mycube.B(mycube, 2); else if (exp[i] == "B'") mycube.b(mycube, 1); else if (exp[i] == "B2'") mycube.b(mycube, 2); else if (exp[i] == "L") mycube.L(mycube, 1); else if (exp[i] == "L2") mycube.L(mycube, 2); else if (exp[i] == "L'") mycube.l(mycube, 1); else if (exp[i] == "L2'") mycube.l(mycube, 2); else if (exp[i] == "R") mycube.R(mycube, 1); else if (exp[i] == "R2") mycube.R(mycube, 2); else if (exp[i] == "R'") mycube.r(mycube, 1); else if (exp[i] == "R2'") mycube.r(mycube, 2); else if (exp[i] == "U") mycube.U(mycube, 1); else if (exp[i] == "U2") mycube.U(mycube, 2); else if (exp[i] == "U'") mycube.u(mycube, 1); else if (exp[i] == "U2'") mycube.u(mycube, 2); else if (exp[i] == "D") mycube.D(mycube, 1); else if (exp[i] == "D2") mycube.D(mycube, 2); else if (exp[i] == "D'") mycube.d(mycube, 1); else if (exp[i] == "D2'") mycube.d(mycube, 2); } for (int i = 0; i < backcolor.Length; ) { for (int j = 0; j < 3; j++) for (int k = 0; k < 3; k++) backcolor[i++] = rechange(mycube.up[j, k]); for (int j = 0; j < 3; j++) for (int k = 0; k < 3; k++) backcolor[i++] = rechange(mycube.down[j, k]); for (int j = 0; j < 3; j++) for (int k = 0; k < 3; k++) backcolor[i++] = rechange(mycube.left[j, k]); for (int j = 0; j < 3; j++) for (int k = 0; k < 3; k++) backcolor[i++] = rechange(mycube.right[j, k]); for (int j = 0; j < 3; j++) for (int k = 0; k < 3; k++) backcolor[i++] = rechange(mycube.front[j, k]); for (int j = 0; j < 3; j++) for (int k = 0; k < 3; k++) backcolor[i++] = rechange(mycube.back[j, k]); } this.Close(); }
private void btn_start_Click(object sender, EventArgs e) { Cube mycube = new Cube(); mycube.front[0, 0] = change(pnl_front1); mycube.front[0, 1] = change(pnl_front2); mycube.front[0, 2] = change(pnl_front3); mycube.front[1, 0] = change(pnl_front4); mycube.front[1, 1] = 'r'; mycube.front[1, 2] = change(pnl_front5); mycube.front[2, 0] = change(pnl_front6); mycube.front[2, 1] = change(pnl_front7); mycube.front[2, 2] = change(pnl_front8); mycube.back[0, 0] = change(pnl_back1); mycube.back[0, 1] = change(pnl_back2); mycube.back[0, 2] = change(pnl_back3); mycube.back[1, 0] = change(pnl_back4); mycube.back[1, 1] = 'o'; mycube.back[1, 2] = change(pnl_back5); mycube.back[2, 0] = change(pnl_back6); mycube.back[2, 1] = change(pnl_back7); mycube.back[2, 2] = change(pnl_back8); mycube.left[0, 0] = change(pnl_left1); mycube.left[0, 1] = change(pnl_left2); mycube.left[0, 2] = change(pnl_left3); mycube.left[1, 0] = change(pnl_left4); mycube.left[1, 1] = 'b'; mycube.left[1, 2] = change(pnl_left5); mycube.left[2, 0] = change(pnl_left6); mycube.left[2, 1] = change(pnl_left7); mycube.left[2, 2] = change(pnl_left8); mycube.right[0, 0] = change(pnl_right1); mycube.right[0, 1] = change(pnl_right2); mycube.right[0, 2] = change(pnl_right3); mycube.right[1, 0] = change(pnl_right4); mycube.right[1, 1] = 'g'; mycube.right[1, 2] = change(pnl_right5); mycube.right[2, 0] = change(pnl_right6); mycube.right[2, 1] = change(pnl_right7); mycube.right[2, 2] = change(pnl_right8); mycube.up[0, 0] = change(pnl_up1); mycube.up[0, 1] = change(pnl_up2); mycube.up[0, 2] = change(pnl_up3); mycube.up[1, 0] = change(pnl_up4); mycube.up[1, 1] = 'y'; mycube.up[1, 2] = change(pnl_up5); mycube.up[2, 0] = change(pnl_up6); mycube.up[2, 1] = change(pnl_up7); mycube.up[2, 2] = change(pnl_up8); mycube.down[0, 0] = change(pnl_down1); mycube.down[0, 1] = change(pnl_down2); mycube.down[0, 2] = change(pnl_down3); mycube.down[1, 0] = change(pnl_down4); mycube.down[1, 1] = 'w'; mycube.down[1, 2] = change(pnl_down5); mycube.down[2, 0] = change(pnl_down6); mycube.down[2, 1] = change(pnl_down7); mycube.down[2, 2] = change(pnl_down8); //还原魔方 listview.Items.Clear(); mycube.count = 0; mycube.sequence[0] = '\0'; try { mycube.Cross(mycube); mycube.F2L(mycube); mycube.OLL(mycube); mycube.PLL(mycube); mycube.cut(mycube); for (int i = 0; mycube.str[i] != null; i++) { listview.Items.Add((i + 1).ToString()); listview.Items[i].SubItems.Add(mycube.str[i]); listview.Items[i].SubItems.Add(mycube.sign[i]); } } catch { MessageBox.Show("请检查颜色是否填充正确!"); } }
//OLL顶部朝向调整(57种情况) public void OLL(Cube cube) { while (!(cube.up[0, 0] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1])) { //OLL1 if (cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1]) { cube.R(cube, 1); cube.U(cube, 2); cube.r(cube, 2); cube.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); cube.U(cube, 2); cube.r(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); } //OLL2 else if (cube.back[2, 1] == cube.up[1, 1] && cube.back[2, 2] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1]) { cube.F(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.f(cube, 1); cube.B(cube, 1); cube.U(cube, 1); cube.L(cube, 1); cube.u(cube, 1); cube.l(cube, 1); cube.b(cube, 1); } //OLL3 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.B(cube, 1); cube.U(cube, 1); cube.L(cube, 1); cube.u(cube, 1); cube.l(cube, 1); cube.b(cube, 1); cube.u(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.f(cube, 1); } //OLL4 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1]) { cube.B(cube, 1); cube.U(cube, 1); cube.L(cube, 1); cube.u(cube, 1); cube.l(cube, 1); cube.b(cube, 1); cube.R(cube, 1); cube.B(cube, 1); cube.U(cube, 1); cube.b(cube, 1); cube.u(cube, 1); cube.r(cube, 1); } //OLL5 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.F(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.f(cube, 1); cube.U(cube, 1); cube.F(cube, 1); cube.R(cube, 2); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.f(cube, 1); } //OLL6 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.back[2, 2] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.F(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.U(cube, 1); cube.f(cube, 1); cube.U(cube, 2); cube.f(cube, 1); cube.L(cube, 1); cube.F(cube, 1); cube.l(cube, 1); } //OLL7 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1]) { cube.l(cube, 1); cube.R(cube, 1); cube.B(cube, 1); cube.R(cube, 1); cube.B(cube, 1); cube.r(cube, 1); cube.b(cube, 1); cube.L(cube, 1); cube.r(cube, 2); cube.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); } //OLL8 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.l(cube, 1); cube.R(cube, 1); cube.B(cube, 1); cube.R(cube, 1); cube.B(cube, 1); cube.r(cube, 1); cube.b(cube, 1); cube.L(cube, 2); cube.r(cube, 2); cube.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); cube.l(cube, 1); } //OLL9 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[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.f(cube, 1); cube.L(cube, 1); cube.F(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.l(cube, 1); } //OLL10 else if (cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.R(cube, 1); cube.U(cube, 2); cube.r(cube, 2); cube.u(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.U(cube, 2); cube.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); } //OLL11 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1]) { cube.F(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.f(cube, 1); } //OLL12 else if (cube.back[2, 0] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[2, 1] == cube.up[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.f(cube, 1); cube.U(cube, 1); cube.F(cube, 1); cube.B(cube, 1); } //OLL13 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 2] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1]) { cube.L(cube, 1); cube.F(cube, 2); cube.r(cube, 1); cube.f(cube, 1); cube.R(cube, 1); cube.F(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.R(cube, 1); cube.f(cube, 1); cube.l(cube, 1); } //OLL14 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.back[2, 2] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.l(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); cube.B(cube, 1); cube.r(cube, 1); cube.B(cube, 1); cube.L(cube, 1); } //OLL15 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.R(cube, 1); cube.b(cube, 1); cube.R(cube, 2); cube.F(cube, 1); cube.R(cube, 2); cube.B(cube, 1); cube.R(cube, 2); cube.f(cube, 1); cube.R(cube, 1); } //OLL16 else if (cube.back[2, 0] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1]) { cube.r(cube, 1); cube.F(cube, 1); cube.R(cube, 2); cube.b(cube, 1); cube.R(cube, 2); cube.f(cube, 1); cube.R(cube, 2); cube.B(cube, 1); cube.r(cube, 1); } //OLL17 else if (cube.back[2, 2] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[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.u(cube, 1); cube.f(cube, 1); } //OLL18 else if (cube.back[2, 1] == cube.up[1, 1] && cube.back[2, 2] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 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.u(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.B(cube, 1); } //OLL19 else if (cube.back[2, 0] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1]) { cube.L(cube, 1); cube.F(cube, 1); cube.r(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.F(cube, 2); cube.l(cube, 1); } //OLL20 else if (cube.back[2, 1] == cube.up[1, 1] && cube.back[2, 2] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.l(cube, 1); cube.b(cube, 1); cube.R(cube, 1); cube.b(cube, 1); cube.r(cube, 1); cube.B(cube, 2); cube.L(cube, 1); } //OLL21 else if (cube.back[2, 2] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1]) { cube.L(cube, 1); cube.R(cube, 2); cube.f(cube, 1); cube.R(cube, 1); cube.f(cube, 1); cube.r(cube, 1); cube.F(cube, 2); cube.R(cube, 1); cube.f(cube, 1); cube.R(cube, 1); cube.l(cube, 1); } //OLL22 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.l(cube, 1); cube.R(cube, 2); cube.B(cube, 1); cube.r(cube, 1); cube.B(cube, 1); cube.R(cube, 1); cube.B(cube, 2); cube.r(cube, 1); cube.B(cube, 1); cube.L(cube, 1); cube.r(cube, 1); } //OLL23 else if (cube.back[2, 2] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 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); cube.U(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); } //OLL24 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[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, 1); cube.f(cube, 1); cube.R(cube, 1); cube.U(cube, 2); cube.r(cube, 1); } //OLL25 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.l(cube, 1); cube.B(cube, 2); cube.R(cube, 1); cube.B(cube, 1); cube.r(cube, 1); cube.B(cube, 1); cube.L(cube, 1); } //OLL26 else if (cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1]) { cube.L(cube, 1); cube.F(cube, 2); cube.r(cube, 1); cube.f(cube, 1); cube.R(cube, 1); cube.f(cube, 1); cube.l(cube, 1); } //OLL27 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1]) { cube.L(cube, 1); cube.f(cube, 1); cube.l(cube, 1); cube.u(cube, 1); cube.L(cube, 1); cube.F(cube, 1); cube.l(cube, 1); cube.f(cube, 1); cube.U(cube, 1); cube.F(cube, 1); } //OLL28 else if (cube.back[2, 2] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.r(cube, 1); cube.F(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); cube.u(cube, 1); cube.f(cube, 1); } //OLL29 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1]) { cube.L(cube, 1); cube.F(cube, 1); cube.l(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.L(cube, 1); cube.f(cube, 1); cube.l(cube, 1); } //OLL30 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1]) { cube.r(cube, 1); cube.f(cube, 1); cube.R(cube, 1); cube.l(cube, 1); cube.u(cube, 1); cube.L(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.F(cube, 1); cube.R(cube, 1); } //OLL31 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.r(cube, 1); cube.U(cube, 2); cube.R(cube, 1); cube.F(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.f(cube, 1); } //OLL32 else if (cube.back[2, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.L(cube, 1); cube.F(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.l(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); } //OLL33 else if (cube.front[0, 2] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.f(cube, 1); cube.L(cube, 1); cube.F(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.l(cube, 1); cube.F(cube, 1); cube.R(cube, 1); } //OLL34 else if (cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.R(cube, 1); cube.U(cube, 2); cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.r(cube, 1); } //OLL35 else if (cube.back[2, 0] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 1] == cube.up[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, 2); cube.r(cube, 1); } //OLL36 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 2] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.R(cube, 1); cube.U(cube, 2); 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); } //OLL37 else if (cube.back[2, 2] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.R(cube, 1); cube.U(cube, 2); cube.R(cube, 2); cube.u(cube, 1); cube.R(cube, 2); cube.u(cube, 1); cube.R(cube, 2); cube.u(cube, 2); cube.R(cube, 1); } //OLL38 else if (cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1]) { cube.F(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.f(cube, 1); } //OLL39 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1]) { cube.b(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.B(cube, 1); } //OLL40 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.R(cube, 1); cube.u(cube, 2); cube.R(cube, 2); cube.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); cube.R(cube, 1); cube.U(cube, 2); cube.r(cube, 1); } //OLL41 else if (cube.back[2, 1] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.F(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.f(cube, 1); } //OLL42 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 2] == cube.up[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, 1); cube.f(cube, 1); } //OLL43 else if (cube.back[2, 1] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.left[0, 2] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1]) { 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.B(cube, 1); cube.u(cube, 1); cube.r(cube, 1); } //OLL44 else if (cube.back[2, 1] == cube.up[1, 1] && cube.back[2, 2] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 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.f(cube, 1); cube.U(cube, 1); cube.R(cube, 1); } //OLL45 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1]) { cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.b(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.B(cube, 1); } //OLL46 else if (cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 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); cube.U(cube, 1); cube.R(cube, 1); } //OLL47 else if (cube.back[2, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 0] == cube.up[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.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); } //OLL48 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1] && cube.up[2, 2] == cube.up[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.b(cube, 1); cube.r(cube, 1); cube.B(cube, 1); } //OLL49 else if (cube.back[2, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.r(cube, 1); cube.u(cube, 1); cube.F(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); } //OLL50 else if (cube.right[0, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 2] == cube.up[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); } //OLL51 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 2] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[2, 2] == cube.up[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, 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.f(cube, 1); } //OLL52 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.front[0, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 1); cube.U(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.U(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.f(cube, 1); } //OLL53 else if (cube.back[2, 1] == cube.up[1, 1] && cube.right[2, 0] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.left[2, 2] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1]) { cube.R(cube, 2); cube.U(cube, 1); cube.r(cube, 1); cube.b(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.R(cube, 2); cube.U(cube, 1); cube.R(cube, 1); cube.B(cube, 1); cube.r(cube, 1); } //OLL54 else if (cube.back[2, 0] == cube.up[1, 1] && cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 2] == cube.up[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.f(cube, 1); cube.u(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); } //OLL55 else if (cube.back[2, 0] == cube.up[1, 1] && cube.back[2, 1] == cube.up[1, 1] && cube.front[0, 0] == cube.up[1, 1] && cube.left[1, 2] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 1] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.R(cube, 1); cube.U(cube, 1); cube.b(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, 1); } //OLL56 else if (cube.right[1, 0] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[0, 1] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.L(cube, 1); cube.F(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.l(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.r(cube, 1); } //OLL57 else if (cube.back[2, 1] == cube.up[1, 1] && cube.front[0, 1] == cube.up[1, 1] && cube.up[0, 0] == cube.up[1, 1] && cube.up[0, 2] == cube.up[1, 1] && cube.up[1, 0] == cube.up[1, 1] && cube.up[1, 2] == cube.up[1, 1] && cube.up[2, 0] == cube.up[1, 1] && cube.up[2, 2] == cube.up[1, 1]) { cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.L(cube, 1); cube.r(cube, 1); cube.F(cube, 1); cube.R(cube, 1); cube.f(cube, 1); cube.l(cube, 1); } else cube.U(cube, 1); } }
//F2L底层和中层两层还原 public void F2L(Cube cube) { //底层 while (!(cube.down[0, 0] == cube.down[1, 1] && cube.down[2, 0] == cube.down[1, 1] && cube.down[0, 2] == cube.down[1, 1] && cube.down[2, 2] == cube.down[1, 1] && cube.front[2, 0] == cube.front[1, 1] && cube.right[2, 2] == cube.right[1, 1] && cube.back[0, 2] == cube.back[1, 1] && cube.left[2, 0] == cube.left[1, 1])) { //底块在上层四角 //底面向上 if (cube.up[0, 0] == cube.down[1, 1] || cube.up[0, 2] == cube.down[1, 1] || cube.up[2, 0] == cube.down[1, 1] || cube.up[2, 2] == cube.down[1, 1]) { if (cube.up[2, 2] == cube.down[1, 1] && cube.front[0, 2] == cube.right[1, 1] && cube.right[2, 0] == cube.front[1, 1]) { cube.R(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.f(cube, 1); cube.U(cube, 2); cube.F(cube, 1); } else if (cube.up[2, 0] == cube.down[1, 1] && cube.front[0, 0] == cube.left[1, 1] && cube.left[2, 2] == cube.front[1, 1]) { cube.l(cube, 1); cube.U(cube, 1); cube.L(cube, 1); cube.F(cube, 1); cube.U(cube, 2); cube.f(cube, 1); } else if (cube.up[0, 2] == cube.down[1, 1] && cube.right[0, 0] == cube.back[1, 1] && cube.back[2, 2] == cube.right[1, 1]) { cube.B(cube, 1); cube.u(cube, 1); cube.b(cube, 1); cube.r(cube, 1); cube.U(cube, 2); cube.R(cube, 1); } else if (cube.up[0, 0] == cube.down[1, 1] && cube.left[0, 2] == cube.back[1, 1] && cube.back[2, 0] == cube.left[1, 1]) { cube.b(cube, 1); cube.U(cube, 1); cube.B(cube, 1); cube.L(cube, 1); cube.U(cube, 2); cube.l(cube, 1); } else cube.U(cube, 1); } //底面在侧 else if (cube.front[0, 0] == cube.down[1, 1] || cube.front[0, 2] == cube.down[1, 1] || cube.back[2, 0] == cube.down[1, 1] || cube.back[2, 2] == cube.down[1, 1] || cube.left[0, 2] == cube.down[1, 1] || cube.left[2, 2] == cube.down[1, 1] || cube.right[0, 0] == cube.down[1, 1] || cube.right[2, 0] == cube.down[1, 1]) { if (cube.front[0, 0] == cube.down[1, 1] && cube.up[2, 0] == cube.front[1, 1] && cube.left[2, 2] == cube.left[1, 1]) { cube.F(cube, 1); cube.U(cube, 1); cube.f(cube, 1); } else if (cube.front[0, 2] == cube.down[1, 1] && cube.up[2, 2] == cube.front[1, 1] && cube.right[2, 0] == cube.right[1, 1]) { cube.f(cube, 1); cube.u(cube, 1); cube.F(cube, 1); } else if (cube.back[2, 0] == cube.down[1, 1] && cube.up[0, 0] == cube.back[1, 1] && cube.left[0, 2] == cube.left[1, 1]) { cube.b(cube, 1); cube.u(cube, 1); cube.B(cube, 1); } else if (cube.back[2, 2] == cube.down[1, 1] && cube.up[0, 2] == cube.back[1, 1] && cube.right[0, 0] == cube.right[1, 1]) { cube.B(cube, 1); cube.U(cube, 1); cube.b(cube, 1); } else if (cube.left[0, 2] == cube.down[1, 1] && cube.up[0, 0] == cube.left[1, 1] && cube.back[2, 0] == cube.back[1, 1]) { cube.L(cube, 1); cube.U(cube, 1); cube.l(cube, 1); } else if (cube.left[2, 2] == cube.down[1, 1] && cube.up[2, 0] == cube.left[1, 1] && cube.front[0, 0] == cube.front[1, 1]) { cube.l(cube, 1); cube.u(cube, 1); cube.L(cube, 1); } else if (cube.right[0, 0] == cube.down[1, 1] && cube.up[0, 2] == cube.right[1, 1] && cube.back[2, 2] == cube.back[1, 1]) { cube.r(cube, 1); cube.u(cube, 1); cube.R(cube, 1); } else if (cube.right[2, 0] == cube.down[1, 1] && cube.up[2, 2] == cube.right[1, 1] && cube.front[0, 2] == cube.front[1, 1]) { cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); } else cube.U(cube, 1); } //底块在底层但是位置不对 else { if (cube.front[2, 2] == cube.down[1, 1] || cube.right[2, 2] == cube.down[1, 1] || (cube.down[2, 0] == cube.down[1, 1] && (cube.front[2, 2] != cube.front[1, 1] || cube.right[2, 2] != cube.right[1, 1]))) { cube.R(cube, 1); cube.U(cube, 1); cube.r(cube, 1); } else if (cube.front[2, 0] == cube.down[1, 1] || cube.left[2, 0] == cube.down[1, 1] || (cube.down[2, 2] == cube.down[1, 1] && (cube.front[2, 0] != cube.front[1, 1] || cube.left[2, 0] != cube.left[1, 1]))) { cube.l(cube, 1); cube.u(cube, 1); cube.L(cube, 1); } else if (cube.left[0, 0] == cube.down[1, 1] || cube.back[0, 0] == cube.down[1, 1] || (cube.down[0, 2] == cube.down[1, 1] && (cube.left[0, 0] != cube.left[1, 1] || cube.back[0, 0] != cube.back[1, 1]))) { cube.b(cube, 1); cube.u(cube, 1); cube.B(cube, 1); } else { cube.B(cube, 1); cube.U(cube, 1); cube.b(cube, 1); } } } //中层 while (!(cube.front[1, 2] == cube.front[1, 1] && cube.right[2, 1] == cube.right[1, 1] && cube.right[0, 1] == cube.right[1, 1] && cube.back[1, 0] == cube.back[1, 1] && cube.back[1, 2] == cube.back[1, 1] && cube.left[0, 1] == cube.left[1, 1] && cube.left[2, 1] == cube.left[1, 1] && cube.front[1, 0] == cube.front[1, 1])) { //在上层的情况 if ((cube.up[0, 1] != cube.up[1, 1] && cube.back[2, 1] != cube.up[1, 1]) || (cube.up[1, 0] != cube.up[1, 1] && cube.left[1, 2] != cube.up[1, 1]) || (cube.up[2, 1] != cube.up[1, 1] && cube.front[0, 1] != cube.up[1, 1]) || (cube.up[1, 2] != cube.up[1, 1] && cube.right[1, 0] != cube.up[1, 1])) { if (cube.up[0, 1] != cube.up[1, 1] && cube.back[2, 1] == cube.back[1, 1]) { if (cube.up[0, 1] == cube.left[1, 1]) { cube.U(cube, 1); cube.L(cube, 1); cube.u(cube, 1); cube.l(cube, 1); cube.u(cube, 1); cube.b(cube, 1); cube.U(cube, 1); cube.B(cube, 1); } else { cube.u(cube, 1); cube.r(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.U(cube, 1); cube.B(cube, 1); cube.u(cube, 1); cube.b(cube, 1); } } else if (cube.up[1, 0] != cube.up[1, 1] && cube.left[1, 2] == cube.left[1, 1]) { if (cube.up[1, 0] == cube.back[1, 1]) { cube.u(cube, 1); cube.b(cube, 1); cube.U(cube, 1); cube.B(cube, 1); cube.U(cube, 1); cube.L(cube, 1); cube.u(cube, 1); cube.l(cube, 1); } else { cube.U(cube, 1); cube.F(cube, 1); cube.u(cube, 1); cube.f(cube, 1); cube.u(cube, 1); cube.l(cube, 1); cube.U(cube, 1); cube.L(cube, 1); } } else if (cube.up[2, 1] != cube.up[1, 1] && cube.front[0, 1] == cube.front[1, 1]) { if (cube.up[2, 1] == cube.right[1, 1]) { cube.U(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.f(cube, 1); cube.U(cube, 1); cube.F(cube, 1); } else { cube.u(cube, 1); cube.l(cube, 1); cube.U(cube, 1); cube.L(cube, 1); cube.U(cube, 1); cube.F(cube, 1); cube.u(cube, 1); cube.f(cube, 1); } } else if (cube.up[1, 2] != cube.up[1, 1] && cube.right[1, 0] == cube.right[1, 1]) { if (cube.up[1, 2] == cube.front[1, 1]) { cube.u(cube, 1); cube.f(cube, 1); cube.U(cube, 1); cube.F(cube, 1); cube.U(cube, 1); cube.R(cube, 1); cube.u(cube, 1); cube.r(cube, 1); } else { cube.U(cube, 1); cube.B(cube, 1); cube.u(cube, 1); cube.b(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.U(cube, 1); cube.R(cube, 1); } } else cube.U(cube, 1); } //在中层的情况 else { if (cube.front[1, 2] != cube.front[1, 1]) { cube.R(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.u(cube, 1); cube.f(cube, 1); cube.U(cube, 1); cube.F(cube, 1); } else if (cube.right[0, 1] != cube.right[1, 1]) { cube.B(cube, 1); cube.u(cube, 1); cube.b(cube, 1); cube.u(cube, 1); cube.r(cube, 1); cube.U(cube, 1); cube.R(cube, 1); } else if (cube.back[1, 0] != cube.back[1, 1]) { cube.L(cube, 1); cube.u(cube, 1); cube.l(cube, 1); cube.u(cube, 1); cube.b(cube, 1); cube.U(cube, 1); cube.B(cube, 1); } else { cube.F(cube, 1); cube.u(cube, 1); cube.f(cube, 1); cube.u(cube, 1); cube.l(cube, 1); cube.U(cube, 1); cube.L(cube, 1); } } } }
//2.删减重复的还原步骤 public void cut(Cube cube) { int t = 1, k = 0, flag = 0; for (int i = 0; cube.sequence[i] != '\0'; i++) { if (cube.sequence[i] > 'Z') flag--; else flag++; if (cube.sequence[i] == cube.sequence[i + 1] + 32 || cube.sequence[i] == cube.sequence[i + 1] - 32 || cube.sequence[i] == cube.sequence[i + 1]) { if (cube.sequence[i] == cube.sequence[i + 1]) t++; else t--; } else { if (t == 0 || t == 4) { t = 1; continue; } else if (t % 3 == 0) { if (cube.sequence[i] > 'Z') { str[k] = tran(cube.sequence[i]).Replace('逆', '顺') + (t - 2) * 90 + "度"; sign[k] = cube.sequence[i].ToString().ToUpper(); } else { str[k] = tran(cube.sequence[i]).Replace('顺', '逆') + (t - 2) * 90 + "度"; sign[k] = cube.sequence[i].ToString().ToUpper() + "'"; } } else { str[k] = tran(cube.sequence[i]) + t * 90 + "度"; if (flag < 0) if (t == 1) sign[k] = cube.sequence[i].ToString().ToUpper() + "'"; else sign[k] = cube.sequence[i].ToString().ToUpper() + t.ToString() + "'"; else if (t == 1) sign[k] = cube.sequence[i].ToString().ToUpper(); else sign[k] = cube.sequence[i].ToString().ToUpper() + t.ToString(); } t = 1; k++; flag = 0; } } }
//魔方公式CFOP //Cross底面十字(以white为底) public void Cross(Cube cube) { //第一步做成顶部花心形 while (!(cube.front[1, 1] == cube.front[2, 1] && cube.back[1, 1] == cube.back[0, 1] && cube.left[1, 1] == cube.left[1, 0] && cube.right[1, 1] == cube.right[1, 2] && cube.down[1, 0] == cube.down[1, 1] && cube.down[1, 2] == cube.down[1, 1] && cube.down[0, 1] == cube.down[1, 1] && cube.down[2, 1] == cube.down[1, 1])) { //处理底块在第一层侧棱的四种情况 while ((cube.front[0, 1] == cube.down[1, 1]) || cube.right[1, 0] == cube.down[1, 1] || (cube.back[2, 1] == cube.down[1, 1]) || (cube.left[1, 2] == cube.down[1, 1])) { if (cube.front[0, 1] == cube.down[1, 1]) { cube.F(cube, 1); cube.exp1(cube); } else if (cube.right[1, 0] == cube.down[1, 1]) { cube.R(cube, 1); cube.exp1(cube); } else if (cube.back[2, 1] == cube.down[1, 1]) { cube.B(cube, 1); cube.exp1(cube); } else { cube.L(cube, 1); cube.exp1(cube); } } //处理底块在第二层侧棱的八种情况 cube.exp1(cube); //处理底块在第三层侧棱的四种情况 while ((cube.front[2, 1] == cube.down[1, 1]) || (cube.right[1, 2] == cube.down[1, 1]) || (cube.back[0, 1] == cube.down[1, 1]) || (cube.left[1, 0] == cube.down[1, 1])) { if (cube.front[2, 1] == cube.down[1, 1]) { while (cube.up[2, 1] == cube.down[1, 1]) cube.U(cube, 1); cube.F(cube, 1); cube.exp1(cube); } else if (cube.right[1, 2] == cube.down[1, 1]) { while (cube.up[1, 2] == cube.down[1, 1]) cube.U(cube, 1); cube.R(cube, 1); cube.exp1(cube); } else if (cube.back[0, 1] == cube.down[1, 1]) { while (cube.up[0, 1] == cube.down[1, 1]) cube.U(cube, 1); cube.B(cube, 1); cube.exp1(cube); } else { while (cube.up[1, 0] == cube.down[1, 1]) cube.U(cube, 1); cube.L(cube, 1); cube.exp1(cube); } } //处理底块在第三层底部但位置不对的四种情况 while ((cube.down[2, 1] == cube.down[1, 1] && cube.front[2, 1] != cube.front[1, 1]) || (cube.down[1, 2] == cube.down[1, 1] && cube.left[1, 0] != cube.left[1, 1]) || (cube.down[0, 1] == cube.down[1, 1] && cube.back[0, 1] != cube.back[1, 1]) || (cube.down[1, 0] == cube.down[1, 1] && cube.right[1, 2] != cube.right[1, 1])) { if (cube.down[2, 1] == cube.down[1, 1] && cube.front[2, 1] != cube.front[1, 1]) { while (cube.up[2, 1] == cube.down[1, 1]) cube.U(cube, 1); cube.F(cube, 1); cube.exp1(cube); } if (cube.down[1, 2] == cube.down[1, 1] && cube.left[1, 0] != cube.left[1, 1]) { while (cube.up[1, 0] == cube.down[1, 1]) cube.U(cube, 1); cube.L(cube, 1); cube.exp1(cube); } if (cube.down[0, 1] == cube.down[1, 1] && cube.back[0, 1] != cube.back[1, 1]) { while (cube.up[0, 1] == cube.down[1, 1]) cube.U(cube, 1); cube.B(cube, 1); cube.exp1(cube); } if (cube.down[1, 0] == cube.down[1, 1] && cube.right[1, 2] != cube.right[1, 1]) { while (cube.up[1, 2] == cube.down[1, 1]) cube.U(cube, 1); cube.R(cube, 1); cube.exp1(cube); } } //处理中心棱块和十字花的位置 while (true) { if (cube.front[0, 1] == cube.front[1, 1] && cube.up[2, 1] == cube.down[1, 1]) cube.F(cube, 2); else if (cube.left[1, 2] == cube.left[1, 1] && cube.up[1, 0] == cube.down[1, 1]) cube.L(cube, 2); else if (cube.right[1, 0] == cube.right[1, 1] && cube.up[1, 2] == cube.down[1, 1]) cube.R(cube, 2); else if (cube.back[2, 1] == cube.back[1, 1] && cube.up[0, 1] == cube.down[1, 1]) cube.B(cube, 2); else if (((cube.front[1, 1] == cube.front[2, 1]) && (cube.back[1, 1] == cube.back[0, 1]) && (cube.left[1, 1] == cube.left[1, 0]) && (cube.right[1, 1] == cube.right[1, 2])) && (cube.down[0, 1] == cube.down[1, 1]) && (cube.down[1, 0] == cube.down[1, 1]) && (cube.down[1, 2] == cube.down[1, 1]) && (cube.down[2, 1] == cube.down[1, 1])) break; else cube.U(cube, 1); } } }
//常用公式整理的函数 //1.处理底块在第二层侧棱的八种情况 private void exp1(Cube cube) { while ((cube.front[1, 0] == cube.down[1, 1]) || (cube.front[1, 2] == cube.down[1, 1]) || (cube.right[0, 1] == cube.down[1, 1]) || (cube.right[2, 1] == cube.down[1, 1]) || (cube.back[1, 0] == cube.down[1, 1]) || (cube.back[1, 2] == cube.down[1, 1]) || (cube.left[0, 1] == cube.down[1, 1]) || (cube.left[2, 1] == cube.down[1, 1])) { if (cube.front[1, 0] == cube.down[1, 1]) { while (cube.up[1, 0] == cube.down[1, 1]) cube.U(cube, 1); cube.l(cube, 1); } else if (cube.front[1, 2] == cube.down[1, 1]) { while (cube.up[1, 2] == cube.down[1, 1]) cube.U(cube, 1); cube.R(cube, 1); } else if (cube.right[2, 1] == cube.down[1, 1]) { while (cube.up[2, 1] == cube.down[1, 1]) cube.U(cube, 1); cube.f(cube, 1); } else if (cube.right[0, 1] == cube.down[1, 1]) { while (cube.up[0, 1] == cube.down[1, 1]) cube.U(cube, 1); cube.B(cube, 1); } else if (cube.back[1, 0] == cube.down[1, 1]) { while (cube.up[1, 0] == cube.down[1, 1]) cube.U(cube, 1); cube.L(cube, 1); } else if (cube.back[1, 2] == cube.down[1, 1]) { while (cube.up[1, 2] == cube.down[1, 1]) cube.U(cube, 1); cube.r(cube, 1); } else if (cube.left[0, 1] == cube.down[1, 1]) { while (cube.up[0, 1] == cube.down[1, 1]) cube.U(cube, 1); cube.b(cube, 1); } else { while (cube.up[2, 1] == cube.down[1, 1]) cube.U(cube, 1); cube.F(cube, 1); } } }
//下面一层逆时针转动 public void d(Cube cube, int n) { char t1, t2, t3; for (int i = 0; i < n; i++) { t1 = cube.front[2, 0]; t2 = cube.front[2, 1]; t3 = cube.front[2, 2]; cube.front[2, 0] = cube.right[2, 2]; cube.front[2, 1] = cube.right[1, 2]; cube.front[2, 2] = cube.right[0, 2]; cube.right[2, 2] = cube.back[0, 2]; cube.right[1, 2] = cube.back[0, 1]; cube.right[0, 2] = cube.back[0, 0]; cube.back[0, 0] = cube.left[2, 0]; cube.back[0, 1] = cube.left[1, 0]; cube.back[0, 2] = cube.left[0, 0]; cube.left[0, 0] = t1; cube.left[1, 0] = t2; cube.left[2, 0] = t3; rotate(cube.down); sequence[count] = 'd'; count++; } }
//左面一层逆时针转动 public void l(Cube cube, int n) { char t1, t2, t3; for (int i = 0; i < n; i++) { t1 = cube.up[0, 0]; t2 = cube.up[1, 0]; t3 = cube.up[2, 0]; cube.up[0, 0] = cube.front[0, 0]; cube.up[1, 0] = cube.front[1, 0]; cube.up[2, 0] = cube.front[2, 0]; cube.front[0, 0] = cube.down[2, 2]; cube.front[1, 0] = cube.down[1, 2]; cube.front[2, 0] = cube.down[0, 2]; cube.down[2, 2] = cube.back[0, 0]; cube.down[1, 2] = cube.back[1, 0]; cube.down[0, 2] = cube.back[2, 0]; cube.back[0, 0] = t1; cube.back[1, 0] = t2; cube.back[2, 0] = t3; rotate(cube.left); sequence[count] = 'l'; count++; } }
//后面一层逆时针转动 public void b(Cube cube, int n) { char t1, t2, t3; for (int i = 0; i < n; i++) { t1 = cube.up[0, 0]; t2 = cube.up[0, 1]; t3 = cube.up[0, 2]; cube.up[0, 0] = cube.left[0, 0]; cube.up[0, 1] = cube.left[0, 1]; cube.up[0, 2] = cube.left[0, 2]; cube.left[0, 0] = cube.down[0, 0]; cube.left[0, 1] = cube.down[0, 1]; cube.left[0, 2] = cube.down[0, 2]; cube.down[0, 0] = cube.right[0, 0]; cube.down[0, 1] = cube.right[0, 1]; cube.down[0, 2] = cube.right[0, 2]; cube.right[0, 0] = t1; cube.right[0, 1] = t2; cube.right[0, 2] = t3; rotate(cube.back); sequence[count] = 'b'; count++; } }
//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; } } } }