예제 #1
0
        static void Main(string[] args)
        {
            General.CreatePlateau();

            while (1 == 1)
            {
                Rovers Rover = General.CreateRover();
                String Steps = General.ReadSteps();

                Rover.GoOn(Steps);

                if (Rover.OutPlateau)
                {
                    Console.WriteLine("Rover is Out Plateau!!..");
                    General.PlateauOuts.Add(Rover.GetDetail());
                }

                if (Rover.PassedOutPlateau)
                {
                    Console.WriteLine("from this point previously exited from the plateau!!!");
                }

                Console.WriteLine(Rover.GetDetail());
            }
        }
예제 #2
0
        public static Rovers CreateRover()
        {
            var RoverDetail = General.ReadAndSplit("Enter Rover Coordinates and Direction (x y N) : ");

            if (RoverDetail.Length != 3)
            {
                WriteAndInvoke("Error Rover Detail!!!!", "CreateRover");
            }

            if (!int.TryParse(RoverDetail[0], out int n) || !int.TryParse(RoverDetail[1], out int m))
            {
                WriteAndInvoke("Error Rover Coordinates!!!!", "CreateRover");
            }


            Directions roverDirection = Directions.N;

            try
            {
                roverDirection = Enum.Parse <Directions>(RoverDetail[2].ToUpper());
            }
            catch
            {
                WriteAndInvoke("Error Rover Direction!..Undefined Direction", "CreateRover");
            }

            Rovers Rover = new Rovers(int.Parse(RoverDetail[0]), int.Parse(RoverDetail[1]), roverDirection);

            return(Rover);
        }