예제 #1
0
        public void CanTurnRow(SimpleDirectionTurn directionTurn, int rowIndex, bool isReverse)
        {
            var cube = new RubiksCube(3);

            cube.Turn(directionTurn);

            AssertRowTurn(cube, rowIndex, isReverse);
        }
예제 #2
0
        public void Turn(SimpleDirectionTurn turn)
        {
            var maxIndex = (ushort)(Size - 1);

            switch (turn)
            {
            case SimpleDirectionTurn.Front:
                Turn(TurnType.Line, maxIndex, TurnDirection.Normal);
                break;

            case SimpleDirectionTurn.FrontReverse:
                Turn(TurnType.Line, maxIndex, TurnDirection.Reverse);
                break;

            case SimpleDirectionTurn.Left:
                Turn(TurnType.Column, 0, TurnDirection.Normal);
                break;

            case SimpleDirectionTurn.LeftReverse:
                Turn(TurnType.Column, 0, TurnDirection.Reverse);
                break;

            case SimpleDirectionTurn.Right:
                Turn(TurnType.Column, maxIndex, TurnDirection.Normal);
                break;

            case SimpleDirectionTurn.RightReverse:
                Turn(TurnType.Column, maxIndex, TurnDirection.Reverse);
                break;

            case SimpleDirectionTurn.Top:
                Turn(TurnType.Line, 0, TurnDirection.Normal);
                break;

            case SimpleDirectionTurn.TopReverse:
                Turn(TurnType.Line, 0, TurnDirection.Reverse);
                break;

            case SimpleDirectionTurn.Bottom:
                Turn(TurnType.Line, maxIndex, TurnDirection.Normal);
                break;

            case SimpleDirectionTurn.BottomReverse:
                Turn(TurnType.Line, maxIndex, TurnDirection.Reverse);
                break;

            case SimpleDirectionTurn.Back:
                Turn(TurnType.Line, 0, TurnDirection.Normal);
                break;

            case SimpleDirectionTurn.BackReverse:
                Turn(TurnType.Line, 0, TurnDirection.Reverse);
                break;

            case SimpleDirectionTurn.Center:
                Turn(TurnType.Line, Middle, TurnDirection.Normal);
                break;

            case SimpleDirectionTurn.CenterReverse:
                Turn(TurnType.Line, Middle, TurnDirection.Reverse);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(turn), turn, null);
            }
        }