private void generateNumbers() { for (int y = 0; y < fieldHeight; y++) { for (int x = 0; x < fieldWidth; x++) { if (lowerTilesField[x, y] == null) { lowerTilesField[x, y] = new Tile(false, countSurroundingMines(x, y)); } } } }
private void generateMines() { Random rand = new Random(); int i = 0; while (i < numberOfMines) { int xPosition = rand.Next(fieldWidth); int yPosition = rand.Next(fieldHeight); if (lowerTilesField[xPosition, yPosition] == null) { lowerTilesField[xPosition, yPosition] = new Tile(true, 0); i++; } } }