public void StartWordsComboSearch(string[] _guessWords, string _wordSeperator = "") { guessWords = _guessWords; wordSeperator = _wordSeperator; StringBuilder sb = new StringBuilder("Search structure: "); sb.Append(prefix); for (int i = 0; i < maxDepth - 1; i++) { sb.Append("<...>"); sb.Append(wordSeperator); } sb.Append("<...>"); sb.Append(postfix); Console.WriteLine(sb); if (prefix + postfix != string.Empty) { HashComparer.CheckString("", prefix, postfix); } if (maxDepth >= 1) { for (int i = 0; i < guessWords.Length; i++) { HashComparer.CheckString(guessWords[i], prefix, postfix); if (maxDepth > 1) { WordsRecurse(1, maxDepth, guessWords[i], i); } } } }
private void CharacterRecurse(int currentDepth, string baseString, char[] characters) { foreach (char character in characters) { string combined = string.Join(string.Empty, baseString, character); HashComparer.CheckString(combined, prefix, postfix); if (currentDepth + 1 < maxDepth) { CharacterRecurse(currentDepth + 1, combined, characters); } } }
private void WordsRecurse(int currentDepth, int maxDepth, string baseString, int wordIndex) { for (int i = 0; i < guessWords.Length; i++) { if (i == wordIndex) { continue; } string combined = String.Join(wordSeperator, baseString, guessWords[i]); HashComparer.CheckString(combined, prefix, postfix); if (currentDepth + 1 < maxDepth) { WordsRecurse(currentDepth + 1, maxDepth, combined, i); } } }
public void StartCharactersComboSearch(char[] characters) { if (prefix + postfix != string.Empty) { HashComparer.CheckString("", prefix, postfix); } if (maxDepth > 0) { foreach (char character in characters) { string charToStr = character.ToString(); HashComparer.CheckString(charToStr, prefix, postfix); if (maxDepth > 1) { CharacterRecurse(1, charToStr, characters); } } } }
public void StartCharactersComboSearchMustContain(string _mustContain, char[] characters) { mustContain = _mustContain; if (prefix + mustContain + postfix != string.Empty) { HashComparer.CheckString(mustContain, prefix, postfix); } if (maxDepth > 0) { foreach (char character in characters) { string charToStr = character.ToString(); HashComparer.CheckStringMustContain(charToStr, mustContain, prefix, postfix); if (maxDepth > 1) { CharacterRecurseMustContain(1, charToStr, characters); } } } }