Пример #1
0
 public void twist(Twist twist)
 {
     _cornerPosition    = twist.apply(_cornerPosition, Type.Corners);
     _cornerOrientation = twist.apply(_cornerOrientation, Type.Corners, orientation: true);
     _edgePosition      = twist.apply(_edgePosition, Type.Edges);
     _centerPosition    = twist.apply(_centerPosition, Type.Centers);
     _twists.AddLast(twist);
 }
Пример #2
0
 private Boolean compare(Twist twist)
 {
     int[] edgeList      = twist.apply(Enumerable.Range(0, 24).ToArray(), Type.Edges);
     int[] edgeReference = jObject [twist.Name] ["Edges"].Select(jv => (int)jv).ToArray();
     Console.WriteLine(string.Join(",", edgeList));
     Console.WriteLine(string.Join(",", edgeReference));
     Console.WriteLine("");
     int[] cornerList      = twist.apply(Enumerable.Range(0, 8).ToArray(), Type.Corners);
     int[] cornerReference = jObject [twist.Name] ["Corners"].Select(jv => (int)jv).ToArray();
     Console.WriteLine(string.Join(",", cornerList));
     Console.WriteLine(string.Join(",", cornerReference));
     Console.WriteLine("");
     int[] centerList      = twist.apply(Enumerable.Range(0, 24).ToArray(), Type.Centers);
     int[] centerReference = jObject [twist.Name] ["Centers"].Select(jv => (int)jv).ToArray();
     Console.WriteLine(string.Join(",", centerList));
     Console.WriteLine(string.Join(",", centerReference));
     Console.WriteLine("");
     return(Enumerable.SequenceEqual(edgeList, edgeReference) &&
            Enumerable.SequenceEqual(cornerList, cornerReference) &&
            Enumerable.SequenceEqual(centerList, centerReference));
 }
Пример #3
0
        /// <summary>
        /// The Twist R2 equals two consecutive R twists. Consequently we
        /// can easily generate the corresponding permutation arrays by applying
        /// R twice.
        /// </summary>
        private Twist(string name, Twist twist, int num)
        {
            _name             = name;
            cornerPermutation = Enumerable.Range(0, 8).ToArray();
            centerPermutation = Enumerable.Range(0, 24).ToArray();
            edgePermutation   = Enumerable.Range(0, 24).ToArray();
            pairPermutation   = Enumerable.Range(0, 12).ToArray();
            cornerOrientation = new int[8];
            pairOrientation   = new int[12];
            edgeOrientation   = new int[24];
            for (int i = 0; i < num; i++)
            {
                cornerPermutation = twist.apply(cornerPermutation, Type.Corners);
                edgePermutation   = twist.apply(edgePermutation, Type.Edges);
                centerPermutation = twist.apply(centerPermutation, Type.Centers);
                cornerOrientation = twist.apply(cornerOrientation, Type.Corners, orientation: true);
                pairPermutation   = twist.apply(pairPermutation, Type.EdgePairs);
                pairOrientation   = twist.apply(pairOrientation, Type.EdgePairs, orientation: true);
                edgeOrientation   = twist.apply(edgeOrientation, Type.Edges, orientation: true);
            }
            // Set the inverse elements; the inverse used so the search algorithm
            // does not need to return and search where its coming from
            switch (num)
            {
            case 2:
                this.inverse = this;
                break;

            case 3:
                this.inverse  = twist;
                twist.inverse = this;
                break;

            default:
                throw new SystemException("Not supported");
            }
        }
Пример #4
0
 public static int[] twist(Twist twist, int[] positions)
 {
     return(null);
 }
Пример #5
0
 public new uvoid twist(Twist twist)
 {
     throw new MissingMethodException("Method for oCube not supported");
 }