示例#1
0
        static void Main(string[] args)
        {
            IRouterFactory routerFactory = new RouterFactory();
            Plateau        plateau       = new Plateau(5, 5);

            var rover = new Domain.Rover(plateau, routerFactory, new Position(1, 2, Orientation.North), "LMLMLMLMM");

            Console.WriteLine(rover.GetCurrentPosition().ToString());
            Console.ReadLine();

            var rover2 = new Domain.Rover(plateau, routerFactory, new Position(3, 3, Orientation.East), "MMRMMRMRRM");

            Console.WriteLine(rover2.GetCurrentPosition().ToString());
            Console.ReadLine();
        }
示例#2
0
 public Rover.Land.Domain.Rover DeployRover(string initialPosition)
 {
     if (!string.IsNullOrEmpty(initialPosition))
     {
         string[] position = initialPosition.Split(' ');
         xPos      = int.Parse(position[0]);
         yPos      = int.Parse(position[1]);
         direction = (Direction)Enum.Parse(typeof(Direction), position[2]);
         Position roverPosition = new Position {
             Position_X = xPos, Position_Y = yPos, Direction = direction
         };
         Rover.Land.Domain.Rover newRover = new Domain.Rover {
             RoverName = Guid.NewGuid().ToString().Substring(0, 5), Position = roverPosition
         };
         return(newRover);
     }
     return(null);
 }