Exemplo n.º 1
0
        // TODO: dependency injection

        static void Main(string[] args)
        {
            // The first line of input is the upper-right coordinates of the rectangular world, the lower-left coordinates are assumed to be 0, 0.
            Console.WriteLine("Hello to Martian Robot sequence!");
            Console.WriteLine("Please, the file path with then instructions");

            string filepath = Console.ReadLine();

            IPlanet mars = CreatePlanet("Mars");

            List <IRover> rovers = ExtractRoverDataFromInput(filepath, mars);

            if (rovers == null)
            {
                Console.WriteLine("Could not create any rover with provided instructions");
            }

            foreach (IRover rover in rovers)
            {
                Console.WriteLine("----Processing Rover------");
                if (!mars.AddRover(rover))
                {
                    Console.WriteLine("Could not add rover to plateau.");
                }
                else
                {
                    RoverController.ExploreArea(mars, rover);
                }
            }

            Console.Read();
            return;
        }