Beispiel #1
0
 static void Main(string[] args)
 {
     Cube a = new Cube("D2  F'  U  R'  F  D2  B2  U2  D2  R'  B'  R  D  B2  D2  B'  F'  U2  D'  B'  F'  L'  R2  U  R2");
     Solver s = new Solver(a);
     Algo alg = s.MegaSolver();
     a.Rotate(alg);
     Console.WriteLine(alg);
     Console.WriteLine(a);
 }
Beispiel #2
0
        public CubeTable(Cube a)
        {
            flip = a.Flip;
            twist = a.Twist;
            slice = a.Slice;

            MakeFlipMoveTable();
            MakeTwistMoveTable();
            MakeSlice1MoveTable();

            MakeTwistSlicePruneTable();
            MakeFlipSlicePruneTable();

            MakeCornerPermMoveTable();
            MakeEdgePermMoveTable();
            MakeSlicePermMoveTable();

            MakeCornerSlicePruneTable();
            MakeEdgeSlicePruneTable();
        }
Beispiel #3
0
 public Solver(Cube a)
 {
     c = (Cube)a.Clone();
     _twoPhaseSoluton = new Algo();
     table = new CubeTable(a);
 }
Beispiel #4
0
        void MakeTwistMoveTable()
        {
            int i, j;
            Cube a = new Cube();

            twistMoveTable = new int[TWIST, MOVES];
            for (i = 0; i < TWIST; i++)
                for (j = 0; j < MOVES; j++)
                {
                    a.Twist = i;
                    a.Rotate(new Move((FaceId)(j / 3), (TurnDir)(j % 3)));
                    twistMoveTable[i, j] = a.Twist;
                }
        }
Beispiel #5
0
        void MakeSlicePermMoveTable()
        {
            int i, j, k;
            Cube a = new Cube();

            slicePermMoveTable = new int[SLICE2, MVS];
            for (i = 0, j = 1; i < SLICE2; i++, j = 1)
                for (k = 0; k < MVS; k++)
                {
                    a.Slice = i;
                    a.Rotate(new Move((FaceId)(j / 3), (TurnDir)(j % 3)));
                    slicePermMoveTable[i, k] = a.Slice%SLICE2;
                    j = nextMove(j);
                }
        }
Beispiel #6
0
        void MakeSlice1MoveTable()
        {
            int i, j;
            Cube a = new Cube();

            sliceMoveTable = new int[SLICE1, MOVES];
            for (i = 0; i < SLICE1; i++)
                for (j = 0; j < MOVES; j++)
                {
                    a.Slice = i*24;
                    a.Rotate(new Move((FaceId)(j / 3), (TurnDir)(j % 3)));
                    sliceMoveTable[i, j] = a.Slice/24;
                }
        }
Beispiel #7
0
        void MakeFlipMoveTable()
        {
            int i, j;
            Cube a = new Cube();

            flipMoveTable = new int[FLIP, MOVES];
            for (i=0;i<FLIP;i++)
                for (j=0;j<MOVES;j++)
                {
                    a.Flip = i;
                    a.Rotate(new Move((FaceId) (j/3), (TurnDir) (j%3)));
                    flipMoveTable[i,j] = a.Flip;
                }
        }
Beispiel #8
0
        void MakeEdgePermMoveTable()
        {
            int i, j, k;
            Cube a = new Cube();

            edgePermMoveTable = new int[PERM, MVS];
            for (i = 0, j = 1; i < PERM; i++, j = 1)
                for (k = 0; k < MVS; k++)
                {
                    a.Edge8Perm = i;
                    a.Rotate(new Move((FaceId) (j/3), (TurnDir) (j%3)));
                    edgePermMoveTable[i, k] = a.Edge8Perm;
                    j = nextMove(j);
                }
        }
Beispiel #9
0
        public object Clone()
        {
            Cube a = new Cube();
            int i;

            for (i = 0; i < 8; i++)
                a.corners[i] = new Corner(this.corners[i].GetPos, this.corners[i].GetOri);
            for (i = 0; i < 12; i++)
                a.edges[i] = new Edge(this.edges[i].GetPos, this.edges[i].GetOri);

            return a;
        }