public void Start()
        {
            //gameInProgress = true;
            // cellsOpened = 0;

            this.playerMatrix = new char[Constants.MatrixRow, Constants.MatrixColumn];
            this.matrix       = new char[Constants.MatrixRow, Constants.MatrixColumn];

            matrix = MinesGenerator.GenerateMinesweeperInMatrix(matrix, minesSimbol: Constants.MinesSymbol);

            matrix = MatrixGenerator.GenerateMatrix(matrix, symbolToSkip: Constants.MinesSymbol);
            for (int i = 0; i < playerMatrix.GetLength(0); i++)
            {
                for (int j = 0; j < playerMatrix.GetLength(1); j++)
                {
                    playerMatrix[i, j] = Constants.Symbol;
                }
            }
            renderer.WriteLine(String.Empty);
            renderer.WriteLine(String.Empty);
            renderer.WriteLine("Welcome to the game “Minesweeper”. Try to reveal all cells without mines. " +
                               "Use 'top' to view the scoreboard, 'restart' to start a new game and 'exit' " +
                               "to quit the game.");
            renderer.WriteLine(String.Empty);

            PrintMatrix(playerMatrix);

            while (gameInProgress)
            {
                Commands();
            }
        }
Example #2
0
        public static void Start()
        {
            gameInProgress = true;
            cellsOpened    = 0;

            playerMatrix = new char[Constants.MatrixRow, Constants.MatrixColumn];
            matrix       = new char[Constants.MatrixRow, Constants.MatrixColumn];

            matrix = MinesGenerator.GenerareMinesweeperInMatrix(matrix);
            for (int i = 0; i < playerMatrix.GetLength(0); i++)
            {
                for (int j = 0; j < playerMatrix.GetLength(1); j++)
                {
                    playerMatrix[i, j] = Constants.Symbol;
                }
            }
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Welcome to the game “Minesweeper”. Try to reveal all cells without mines. " +
                              "Use 'top' to view the scoreboard, 'restart' to start a new game and 'exit' " +
                              "to quit the game.");
            Console.WriteLine();

            PrintMatrix(playerMatrix);

            while (gameInProgress)
            {
                Commands();
            }
        }