示例#1
0
        public void RotateFrontMiddleLayerClockwise90Degree()
        {
            //For the right, up, left, and down side, we need to rotate one row that is close to the front side
            //we start at the up side. The three cubies are the [up, front, {left/front/right}]

            foreach (var side in new sbyte[] { Face.Left, Face.Up, Face.Right })
            {
                sbyte currentFace = Face.Up;

                sbyte currentPosition = side;

                CubieColor saved = Faces[currentFace][currentFace, currentFace, currentPosition];

                for (int i = 0; i < 4; i++)
                {
                    // go counter-clockwise to update each position
                    sbyte nextFace = Face.RotateFrontCounterClockwise90Degree(currentFace);

                    sbyte nextPosition = Face.RotateFrontCounterClockwise90Degree(currentPosition);

                    if (i == 3)
                    {
                        Faces[currentFace][currentFace, currentFace, currentPosition] = saved;
                    }
                    else
                    {
                        Faces[currentFace][currentFace, currentFace, currentPosition] = Faces[nextFace][nextFace, nextFace, nextPosition];
                    }
                    currentFace     = nextFace;
                    currentPosition = nextPosition;
                }
            }

            AdjustFaces();
        }
示例#2
0
		public int CompareTo(CubieColor positionColor)
		{
			if (positionColor.Color != Color)
			{
				return Color - positionColor.Color;
			}

			if (positionColor.NeighborColor1 != NeighborColor1)
			{
				return NeighborColor1 - positionColor.NeighborColor1;
			}

			return NeighborColor2 - positionColor.NeighborColor2;
		}