public void populateGrid() { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { grid[i, j] = new ThreeByThree(); } } }
public static ThreeByThree ThreeByThreeGenerator() { var result = new ThreeByThree(); List <int> remainingNumbers = new List <int>(); for (int i = 1; i < 10; i++) { remainingNumbers.Add(i); } foreach (var item in result.grid) { int index = rng.Next(0, remainingNumbers.Count); int value = remainingNumbers[index]; remainingNumbers.RemoveAt(index); item.value = value; } return(result); }