Example #1
0
        public void Play(Arena arena, Robot robot, string steps)
        {
            var       stepList = new List <char>(steps.ToCharArray());
            Direction direction;

            foreach (var nextStep in stepList)
            {
                switch (nextStep)
                {
                case 'M':
                    _robotService.Move(arena, robot);
                    break;

                case 'L':
                case 'R':
                    Enum.TryParse(nextStep.ToString(), true, out direction);
                    _robotService.Spin(direction, robot);
                    break;
                }
            }
        }