Ejemplo n.º 1
0
        private static void Init()
        {
            if (inited)
            {
                return;
            }
            cs.min2phase.Tools.Init();

            Center1.InitSym();
            Center1.Raw2sym = new int[735471];
            Center1.InitSym2Raw();
            Center1.CreateMoveTable();
            Center1.Raw2sym = null;
            Center1.CreatePrun();

            Center2.Init();

            Center3.Init();

            Edge3.InitMvrot();
            Edge3.InitRaw2Sym();
            Edge3.CreatePrun();

            inited = true;
        }
Ejemplo n.º 2
0
        public static void Init()
        {
            Center2 c = new Center2();

            for (int i = 0; i < 35 * 2; i++)
            {
                for (int m = 0; m < 28; m++)
                {
                    c.Setrl(i);
                    c.Move(Moves.Move2std[m]);
                    Rlmv[i][m] = c.Getrl();
                }
            }

            for (int i = 0; i < 70; i++)
            {
                c.Setrl(i);
                for (int j = 0; j < 16; j++)
                {
                    rlrot[i][j] = c.Getrl();
                    c.Rot(0);
                    if (j % 2 == 1)
                    {
                        c.Rot(1);
                    }
                    if (j % 8 == 7)
                    {
                        c.Rot(2);
                    }
                }
            }

            for (int i = 0; i < 6435; i++)
            {
                c.Setct(i);
                for (int j = 0; j < 16; j++)
                {
                    ctrot[i][j] = (char)c.Getct();
                    c.Rot(0);
                    if (j % 2 == 1)
                    {
                        c.Rot(1);
                    }
                    if (j % 8 == 7)
                    {
                        c.Rot(2);
                    }
                }
            }

            for (int i = 0; i < 6435; i++)
            {
                for (int m = 0; m < 28; m++)
                {
                    c.Setct(i);
                    c.Move(Moves.Move2std[m]);
                    Ctmv[i][m] = (char)c.Getct();
                }
            }

            ArrayExtension.Fill(Ctprun, (sbyte)-1);

            Ctprun[0] = Ctprun[18] = Ctprun[28] = Ctprun[46] = Ctprun[54] = Ctprun[56] = 0;
            int depth = 0;
            int done  = 6;

            while (done != 6435 * 35 * 2)
            {
                for (int i = 0; i < 6435 * 35 * 2; i++)
                {
                    if (Ctprun[i] != depth)
                    {
                        continue;
                    }
                    int ct = i / 70;
                    int rl = i % 70;
                    for (int m = 0; m < 23; m++)
                    {
                        int ctx = Ctmv[ct][m];
                        int rlx = Rlmv[rl][m];
                        int idx = ctx * 70 + rlx;
                        if (Ctprun[idx] == -1)
                        {
                            Ctprun[idx] = (sbyte)(depth + 1);
                            done++;
                        }
                    }
                }
                depth++;
            }
        }