Пример #1
0
        public IMinerGame NewRandomGame(string playerName, Tuple<int, int> rowsCols, int bombs)
        {
            MinerGame game = new MinerGame(rowsCols.Item1, rowsCols.Item2, bombs);

            game.Start();

            return game;
        }
Пример #2
0
        public IMinerGame NewRandomGame(string playerName, Tuple <int, int> rowsCols, int bombs)
        {
            MinerGame game = new MinerGame(rowsCols.Item1, rowsCols.Item2, bombs);

            game.Start();

            return(game);
        }
Пример #3
0
        internal void Test()
        {
            int rows;
            int cols;
            int bombs;
            Console.WriteLine("Hello!\n Enter your name:");
            string name = Console.ReadLine();

            Console.WriteLine("Enter count of rows");
            while (!Int32.TryParse(Console.ReadLine(), out rows) && (rows < 0))
            { Console.WriteLine("You enter not correct number. Please, enter number"); }

            Console.WriteLine("Enter count of colums");
            while (!Int32.TryParse(Console.ReadLine(), out cols) && (cols < 0))
            { Console.WriteLine("You enter not correct number. Please, enter number"); }

            Console.WriteLine("Enter count of bombs");
            while (!Int32.TryParse(Console.ReadLine(), out bombs) && (bombs < 0))
            { Console.WriteLine("You enter not correct number. Please, enter number"); }

            MinerGame game = new MinerGame(rows, cols, bombs);
            game.Start();

            Console.WriteLine("Youre game is starting");

            PrintField(game);

            while (!game.Lose && game.IsGameStarted)
            {
                Console.WriteLine("Enter row");
                while (!Int32.TryParse(Console.ReadLine(), out rows) && (rows < 0))
                { Console.WriteLine("You enter not correct number. Please, enter number"); }

                Console.WriteLine("Enter  colum");
                while (!Int32.TryParse(Console.ReadLine(), out cols) && (cols < 0))
                { Console.WriteLine("You enter not correct number. Please, enter number"); }

                if (game.chengeStatusCells(rows, cols))
                {
                    game.IfWim();
                    if (game.Win)
                    { Console.WriteLine("You win!!!!!!"); }
                    PrintField(game);
                }
                else
                { Console.WriteLine("You entered wrong data"); }
            }
        }
Пример #4
0
        internal void Test()
        {
            int rows;
            int cols;
            int bombs;

            Console.WriteLine("Hello!\n Enter your name:");
            string name = Console.ReadLine();

            Console.WriteLine("Enter count of rows");
            while (!Int32.TryParse(Console.ReadLine(), out rows) && (rows < 0))
            {
                Console.WriteLine("You enter not correct number. Please, enter number");
            }

            Console.WriteLine("Enter count of colums");
            while (!Int32.TryParse(Console.ReadLine(), out cols) && (cols < 0))
            {
                Console.WriteLine("You enter not correct number. Please, enter number");
            }

            Console.WriteLine("Enter count of bombs");
            while (!Int32.TryParse(Console.ReadLine(), out bombs) && (bombs < 0))
            {
                Console.WriteLine("You enter not correct number. Please, enter number");
            }

            MinerGame game = new MinerGame(rows, cols, bombs);

            game.Start();

            Console.WriteLine("Youre game is starting");

            PrintField(game);


            while (!game.Lose && game.IsGameStarted)
            {
                Console.WriteLine("Enter row");
                while (!Int32.TryParse(Console.ReadLine(), out rows) && (rows < 0))
                {
                    Console.WriteLine("You enter not correct number. Please, enter number");
                }

                Console.WriteLine("Enter  colum");
                while (!Int32.TryParse(Console.ReadLine(), out cols) && (cols < 0))
                {
                    Console.WriteLine("You enter not correct number. Please, enter number");
                }

                if (game.chengeStatusCells(rows, cols))
                {
                    game.IfWim();
                    if (game.Win)
                    {
                        Console.WriteLine("You win!!!!!!");
                    }
                    PrintField(game);
                }
                else
                {
                    Console.WriteLine("You entered wrong data");
                }
            }
        }