public bool EqualsCharCount(WordDetails other) { foreach (var charCountKey in charCounts.Keys) { if (other.GetCount(charCountKey) != GetCount(charCountKey)) return false; } return true; }
private static IEnumerable<WordDetails> BuildWords(String fileName) { List<WordDetails> words = new List<WordDetails>(); foreach (String line in File.ReadAllLines(fileName)) { WordDetails details = new WordDetails(line); words.Add(details); } return words; }
private static IEnumerable<WordDetails> GetScrambledWords(String html) { List<WordDetails> words = new List<WordDetails>(); var matches = scrambledWordRegex.Matches(html); for (int i = 0; i < matches.Count; i++) { var match = matches[i]; var word = new WordDetails(match.Groups[1].Value); words.Add(word); } Console.WriteLine("Scrambled words: {0}", String.Join(",", words.Select(w => w.Word).ToArray())); return words; }