Beispiel #1
0
        public void Start()
        {
            Console.WriteLine(@"Welcome to ""Battle Field"" game. ");
            int    size       = 0;
            string readBuffer = null;


            Console.Write("Enter battle field size: n=");
            readBuffer = Console.ReadLine();

            while (!int.TryParse(readBuffer, out size))
            {
                Console.WriteLine("Wrong format!");
                Console.Write("Enter battle field size: n=");
            }

            if (size > 10 || size <= 0)
            {
                Start();
            }
            else
            {
                gameField = GameServices.GenerateField(size);
                StartInteraction();
            }
        }
Beispiel #2
0
        public void Start()
        {
            Console.WriteLine(@"Welcome to ""Battle Field"" game. ");
            Console.Write("Input battlefield size: [Range: 1 to 10] n = ");
            int size = GetInitialInput();

            this.gameField = GameServices.GenerateField(size);
            GameLoop();
        }