public Game() { choice = new Choice[5040]; int x = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (j != i) { for (int k = 0; k < 10; k++) { if (k != j && k != i) { for (int l = 0; l < 10; l++) { if (l != k && l != j && l != i) { int[] temp = new int[] { i, j, k, l }; choice[x] = new Choice(temp); x++; } } } } } } } computerChoice = choice[RandomNumber(0, choice.Length - 1)]; }
void filter(int[] arr, int bulls, int kliot) { int count = 0; int b, k; Choice[] temp_choice = new Choice[5040]; for (int i = 0; i < choice.Length; i++) { b = 0; k = 0; choice[i].test_choice(arr, out b, out k); if (b == bulls && k == kliot) { temp_choice[count] = choice[i]; count++; } } Array.Resize(ref temp_choice, count); choice = temp_choice; temp_choice = null; }