Exemple #1
0
        public PositionMower ApplyCommand(PositionMower position, Command command)
        {
            PositionMower positionMower;

            switch (command)
            {
            case Command.Left:
                positionMower = position.RotateToLeft();
                break;

            case Command.Right:
                positionMower = position.RotateToRight();
                break;

            case Command.Forward:
                positionMower = position.MoveForward(this);
                break;;

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

            Track(positionMower);
            return(positionMower);
        }