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();
        }
 //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);
             }
         }
     }
 }
        //魔方公式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);
         }
     }
 }
 //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;
             }
         }
     }
 }