public static char[,] GenerateField(int size) { char[,] field = new char[size, size]; int minesCount = DetermineMineCount(size); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { field[i, j] = '-'; } } List <Mine> mines = new List <Mine>(); for (int i = 0; i < minesCount; i++) { int mineX = rand.Next(0, size); int mineY = rand.Next(0, size); Mine newMine = new Mine() { X = mineX, Y = mineY }; if (GameServices.Contains(mines, newMine)) { i--; continue; } int mineType = rand.Next('1', '6'); field[mineX, mineY] = Convert.ToChar(mineType); } return(field); }