src/anagramsolver/services/LoopSetsHelper.cs
/// <summary>
/// Beware - cpu time is very expensive down here, since 
/// imagine if we have 5 words each having 100 words to loop through = 100*100*100*100*100 
/// = 10.000.000.000 times to enter this code
/// And that is just for one currentSetLength of which we can have a lot.
/// 
/// Then comes all the permutations below. For 5 words that is 5! = 120 times we have to swap the words to test if the sentence match these 3 MD5.
/// 
/// So to limit work down here we start out with doing a check to see if all the words in the sentence is a subset of the anagram.
/// </summary>
/// <param name="currentSentence"></param>
/// <param name="numberOfJackpots"></param>
/// <param name="currentSetLength"></param>
/// <param name="subsetCounter"></param>
/// <param name="listOfWordPermutationsReplacementString"></param>
cpu time is very expensive down here, since
imagine if we have 5 words each having 100 words to loop through = 100*100*100*100*100
10.000.000.000 times to enter this code
And that is just for one currentSetLength of which we can have a lot.

Then comes all the permutations below. For 5 words that is 5. = 120 times we have to swap the words to test if the sentence match these 3 MD5.

So to limit work down here we start out with doing a check to see if all the words in the sentence is a subset of the anagram.
cpu time is very expensive down here since imagine if we have 5 words each having 100 words to loop through = 100 * 100 * 100 * 100 * 100 10 . 000 . 000 . 000 times to enter this code And that is just for one currentSetLength of which we can have a lot . Then comes all the permutations below . For 5 words that is 5 . = 120 times we have to swap the words to test if the sentence match these 3 MD5 . So to limit work down here we start out with doing a check to see if all the words in the sentence is a subset of the anagram .
private void PleaseEnterTheDeepHoleInsideLoop(int[] currentSentence, ref int numberOfJackpots, TCurrentSetOfXPos currentSetLength, 
            ref ulong subsetCounter, string[] listOfWordPermutationsReplacementString)
        {
            var rows = new int[currentSentence.Length][];
            for (int i = 0; i < currentSentence.Length; i++)
            {
                rows[i] = _wordlistCtrl.TableFilter2_WordMatrix[currentSentence[i]];
            }
            var combinedWordToValidate = CombineRows(rows);
            var isSubset = _anagramCtrl.IsSubset(combinedWordToValidate);
            bool gotJackpot = false;
            if (isSubset)
            {
                subsetCounter++;
                gotJackpot = FetchWordsAndCheckMd5RemoveFoundHash(ref numberOfJackpots, currentSentence, listOfWordPermutationsReplacementString);
            }
        }
private void PleaseEnterTheDeepHoleInsideLoop ( int [ ] currentSentence , ref int numberOfJackpots , TCurrentSetOfXPos currentSetLength , ref ulong subsetCounter , string [ ] listOfWordPermutationsReplacementString ) { var rows = new int [ currentSentence . Length ] [ ] ; for ( int i = 0 ; i < currentSentence . Length ; i ++ ) { rows [ i ] = _wordlistCtrl . TableFilter2_WordMatrix [ currentSentence [ i ] ] ; } var combinedWordToValidate = CombineRows ( rows ) ; var isSubset = _anagramCtrl . IsSubset ( combinedWordToValidate ) ; bool gotJackpot = false ; if ( isSubset ) { subsetCounter ++ ; gotJackpot = FetchWordsAndCheckMd5RemoveFoundHash ( ref numberOfJackpots , currentSentence , listOfWordPermutationsReplacementString ) ; } }
Beware - cpu time is very expensive down here, since
imagine if we have 5 words each having 100 words to loop through = 100*100*100*100*100
 10.000.000.000 times to enter this code
And that is just for one currentSetLength of which we can have a lot.
Beware - cpu time is very expensive down here since imagine if we have 5 words each having 100 words to loop through = 100 * 100 * 100 * 100 * 100 10 . 000 . 000 . 000 times to enter this code And that is just for one currentSetLength of which we can have a lot .
// ConsoleWriteLine(" Combinations: " + combinationCounter + ". Subsets: " + subsetCounter); // Use rows in the TableFilter2_WordMatrix to calculate number of each char in the sentence, so we cen check if the sentence is subset of the anagram // Do MD5 check if the words combined is still a subset of anagram
currentSentence
int[]
None
int
ref
currentSetLength
TCurrentSetOfXPos
None
ulong
ref
listOfWordPermutationsReplacementString
string[]
None
numberOfJackpots
None
subsetCounter
None