private void PartialCombinationsButton_Click(object sender, RoutedEventArgs e) { PrepareGUIforTableView(); int combFilter = GetComboBoxValue(FilterComboBox.SelectedIndex); string fileContent = FetchFileFromUrl(); inputTextBox.Text = fileContent; int[] chosenNumbers = CustomArray.ParseStringArray(Regex.Split(chosenNumbersTextBox.Text, @"(?=\s)")); // Build combinations of five, four, three numbers var combinationsFive = chosenNumbers.Combinations(combFilter); // Create control array of five int[][] tempControlArrayInt = CustomArray.CreateCombinationsArray(combinationsFive, combFilter); // Create final array of five int[][] controlDrawsArray = CustomArray.CropArray(CustomArray.CreateIntArrayFromString(fileContent)); int howManyDrawsConsider = HowManyDrawsConsider(controlDrawsArray); //Compare int[][] tempControlArray = CustomArray.CompareArrays(CustomArray.EPurpose.statistics, outerLoopArray: tempControlArrayInt, innerLoopArray: controlDrawsArray, tempControlArrayInt.Length, startIteration: 0, howManyDrawsConsider, combFilter); //Filter array int[][] finalControlArrayFiltered = CustomArray.ReduceArrayByPushingOutNulls(tempControlArray); //Create string array to be displayed via TableView string[][] partialCombArray = CustomArray.CreatePartialCombArray(finalControlArrayFiltered); //Display DataView view = new DataView(Tables.PopulateDataTable(partialCombArray, Tables.ETableType.partial, new string[] { "Combination", "Count" })); view.Sort = "Combination ASC"; dataGridView.ItemsSource = view; }
int[][] CreateCombinationsArrayToBeDisplayed(int[] chosenNumbers, int[][] tempCombArray, List <Tuple <int, int> > tupleList, int index, int startIteration, int[][] wonDrawsArray) { // Build combinations of five, four, three numbers var combinationsShort = chosenNumbers.Combinations(tupleList[index].Item1); // Create control array of five, four, three numbers int[][] tempControlArrayInt = CustomArray.CreateCombinationsArray(combinationsShort, tupleList[index].Item1); // Create temp array of draws //int[][] controlDrawsArray = CustomArray.CropArray(CustomArray.CreateIntArrayFromString(fileContent)); int[][] tempControlArray = CustomArray.CompareArrays(CustomArray.EPurpose.control, tempControlArrayInt, wonDrawsArray, tempControlArrayInt.Length, startIteration, tupleList[index].Item2, tupleList[index].Item1); //Filter array int[][] finalControlArrayFiltered = CustomArray.ReduceArrayByPushingOutNulls(tempControlArray); //Create temporary combinations array to be filtered int[][] tempCombinationsArray = CustomArray.CompareArrays(tempCombArray, finalControlArrayFiltered, tempCombArray.Length, tupleList[index].Item1); //Prepare final combinations array int[][] finalCombinationsArrayFiltered; if (EvensOddsCheckBox.IsChecked == true) { //Remove evens-only or odds-only combinations int[][] combinationsArrayWithoutEvensOnlyOrOddsOnly = CustomArray.RemoveEvensOrOddsOnlyComb(tempCombinationsArray); //Pull out nulls finalCombinationsArrayFiltered = CustomArray.ReduceArrayByPushingOutNulls(combinationsArrayWithoutEvensOnlyOrOddsOnly); } else { //Pull out nulls finalCombinationsArrayFiltered = CustomArray.ReduceArrayByPushingOutNulls(tempCombinationsArray); } return(finalCombinationsArrayFiltered); }