Exemple #1
0
        static void Main(string[] args)
        {
            MarsDiscoveryInformation marsDiscoveryInformation = new MarsDiscoveryInformation()
            {
                Area = "5 5",
                RoverInformationList = new List <RoverDiscoveryInformation>()
                {
                    new RoverDiscoveryInformation()
                    {
                        Location = "1 2 N",
                        Command  = "LMLMLMLMM"
                    },
                    new RoverDiscoveryInformation()
                    {
                        Location = "3 3 E",
                        Command  = "MMRMMRMRRM"
                    }
                }
            };
            IMarsDiscover marsDiscovery = new MarsDiscover(marsDiscoveryInformation);

            ConsoleWriteInput(marsDiscovery);

            marsDiscovery.ExecuteCommand();

            ConsoleWriteOutput(marsDiscovery);
        }
Exemple #2
0
 public MarsDiscover(MarsDiscoveryInformation marsDiscoveryInformation)
 {
     _roverProcessorList = new ConcurrentBag <IRoverProcessor>();
     _marsArea           = GetMarsArea(marsDiscoveryInformation.Area);
     Parallel.ForEach(marsDiscoveryInformation.RoverInformationList, roverInfo =>
     {
         _roverProcessorList.Add(new RoverProcessor(_marsArea, roverInfo));
     });
 }