예제 #1
0
파일: Cube.cs 프로젝트: noelle/RubiksCube
        /// <summary>
        /// 90 degree rotation of the cube in circular with rotation axis-x direction
        /// </summary>
        /// <param name="direction">The direction (left/right) of the cube</param>
        public void rotateCircular90(Model.Direction direction, bool isRecorded = true)
        {
            string directionText = direction.ToString();

            rotateSurface(Model.CubeSurface.Front, direction, false);
            rotateSurface(Model.CubeSurface.MiddleCircular, direction, false);
            rotateSurface(Model.CubeSurface.Back, direction == Model.Direction.Right ? Model.Direction.Left : Model.Direction.Right, false);
            string imgLocation = direction == Model.Direction.Right ? ImageLocation.CircularRight90 : ImageLocation.CircularLeft90;

            if (isRecorded)
            {
                // Step +1
                this.numberSteps++;
                this.History.Add(new Model.HistoryItem(this.Clone(), NumberSteps, String.Format("90 degree circular {0}", directionText), imgLocation));
            }
        }
예제 #2
0
파일: Cube.cs 프로젝트: noelle/RubiksCube
        /// <summary>
        /// 90 degree rotation of the cube with rotation axis-y in horizontal direction
        /// </summary>
        /// <param name="direction">The direction (left/right) of the cube</param>
        public void rotateHorizontal90(Model.Direction direction, bool isRecorded = true)
        {
            string directionText = direction.ToString();

            rotateSurface(Model.CubeSurface.Top, direction, false);
            rotateSurface(Model.CubeSurface.MiddleHorizontal, direction, false);
            rotateSurface(Model.CubeSurface.Bottom, direction == Model.Direction.Right ? Model.Direction.Left : Model.Direction.Right, false);
            string imgLocation = direction == Model.Direction.Right ? ImageLocation.HorizontalRight90 : ImageLocation.HorizontalLeft90;

            if (isRecorded)
            {
                // Step +1
                this.numberSteps++;
                this.History.Add(new Model.HistoryItem(this.Clone(), NumberSteps, String.Format("90 degree horizontal {0}", directionText), imgLocation));
            }
        }