Пример #1
0
 public Rover(Coordinates coordinates, string direction)
 {
     CurrentCoordinates = coordinates;
     RoverNavigator     = new RoverNavigator(this);
     RoverRotator       = new RoverRotator(this);
     CurrentDirection   = direction;
 }
Пример #2
0
        public void Navigate(char[] instructions)
        {
            foreach (var instruction in instructions)
            {
                switch (instruction)
                {
                case 'M':
                    RoverNavigator.Navigate();
                    break;

                case 'L':
                    RoverRotator.Turn("L");
                    break;

                case 'R':
                    RoverRotator.Turn("R");
                    break;
                }
                ;
            }
        }