Esempio n. 1
0
        private List <Rover> ManuallyInstructions()
        {
            Plateau      plateau;
            Rover        rover;
            List <Rover> roverList = new List <Rover>();

            Console.WriteLine();
            Console.Write("Plateau Upper-Right Coordinat: ");
            plateau = _plateauService.CreatePlateau(Console.ReadLine());

            Console.Write("Rover Position: ");
            var roverPosition = Console.ReadLine();

            Console.Write("Instructions: ");
            var instructions = Console.ReadLine();

            rover = _roverService.CreateRover(roverPosition, instructions);
            _calculateService.RunInstructions(rover, plateau);


            roverList.Add(rover);


            var continueLoop = true;

            while (continueLoop)
            {
                Console.WriteLine();
                Console.WriteLine("Would you like to enter a new rover?");
                Console.Write("('Y' or 'N') -> ");

                var response = Console.ReadLine();
                if (response == "Y")
                {
                    Console.Write("Rover Position: ");
                    roverPosition = Console.ReadLine();
                    Console.Write("Instructions: ");
                    instructions = Console.ReadLine();

                    rover = _roverService.CreateRover(roverPosition, instructions);
                    _calculateService.RunInstructions(rover, plateau);

                    roverList.Add(rover);
                }
                else if (response == "N")
                {
                    return(roverList);
                }
                else
                {
                    continue;
                }
            }

            return(roverList);
        }