private void DecrementLastValidSeedIndex(KnownWordsSeed seedWords) { for (int j = TotalWordsCount - 1; j >= 0; j--) { var currentWordIndex = seedWordsIndices[j]; if (seedWordsIndices[j] + 1 >= seedWords.Words[j].Length) { continue; } var word = seedWords.Words[j][currentWordIndex + 1]; if (string.IsNullOrWhiteSpace(word)) { continue; } seedWordsIndices[j] = ++seedWordsIndices[j]; for (int k = j + 1; k < TotalWordsCount; k++) { seedWordsIndices[k] = 0; } break; } }
private static int GetTotalCombinationsFromSeed(KnownWordsSeed seedWords) { return(seedWords.Words.Aggregate(1, (totalCount, words) => { var count = words.Count(x => !string.IsNullOrWhiteSpace(x)); if (count == 0) { return totalCount; } return totalCount * count; })); }