Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 //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;
             }
         }
     }
 }