예제 #1
0
        public void ExecuteInstructions(string instructions)
        {
            instructions = instructions.ToLower();
            foreach (char i in instructions)
            {
                switch (i)
                {
                case 'l':
                    _robot.CommandLeft();
                    break;

                case 'r':
                    _robot.CommandRight();
                    break;

                case 'm':
                    _robot.CommandMove();
                    break;

                default: throw new ArgumentException("Invalid instruction " + i);
                }
            }
        }