Example #1
0
 public void SetUp()
 {
     List<int[]> obstacles = new List<int[]>()
     {
         new int[] { 4, 4 }, new int[] { 4, 5 }, new int[] { 4, 6 },
         new int[] { 5, 4 }, new int[] { 5, 5 }, new int[] { 5, 6 },
         new int[] { 6, 4 }, new int[] { 6, 5 }, new int[] { 6, 6 },
     };
     mars = new Map(10, 10);
     mars.Obstacles = obstacles;
 }
 public void SetUp()
 {
     List<int[]> obstacles = new List<int[]>()
     {
         new int[] { 4, 4 }, new int[] { 4, 5 }, new int[] { 4, 6 },
         new int[] { 5, 4 }, new int[] { 5, 5 }, new int[] { 5, 6 },
         new int[] { 6, 4 }, new int[] { 6, 5 }, new int[] { 6, 6 },
     };
     mars = new Map(10, 10);
     mars.Obstacles = obstacles;
     marsRover = new Rover(new NorthFacingRover(), mars);
 }
        public static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                PrintUsage();
                return;
            }

            mars = new Map(MapWidth, MapHeight);
            mars.Obstacles = GenerateObstacles();
            Console.WriteLine("Generated {0} obstacles on mars!", mars.Obstacles.Count);
            Rover marsRover = new Rover(new NorthFacingRover(StartX, StartY), mars);
            foreach (char movement in args[0])
            {
                if (!marsRover.MoveRover(movement))
                {
                    return;
                }
            }

            Console.WriteLine("Rover moved to: ({0}, {1})", marsRover.X, marsRover.Y);
        }
Example #4
0
 public Rover(IRover rover, Map map)
 {
     InternalRover = rover;
     Planet = map;
 }