public void TestIsInsideSpaced() { var ags = new AnagramSolver("ailnooprssttttuuwy", new List<string>()); Assert.IsTrue(ags.isInsideSpace("iloprstttu")); // Trustpilot! Assert.IsTrue(ags.isInsideSpace("wyioloprstttu")); Assert.IsTrue(ags.isInsideSpace("")); Assert.IsFalse(ags.isInsideSpace("qlk")); }
public void TestTwoWord() { var words = new List<String>(); words.Add("bird"); words.Add("word"); // Bird is the word! var ag = new AnagramSolver("bird word", words); var anagram = ag.FindAnagram("80584d36adfcd7c41cf421f10aa408aa"); Assert.AreEqual("word bird", anagram); }
public void TestTwoWord2() { var words = new List<String>(); words.Add("bird"); words.Add("word"); words.Add("wrod"); // Bird is the word! var ag = new AnagramSolver("bird word", words); var anagram = ag.FindAnagram("843281363c1d2406e9479ebad2c2e2b1"); Assert.AreEqual("bird wrod", anagram); }
public void TestSingleWord() { var words = new List<String>(); words.Add("rbid"); words.Add("irdb"); // c75e59ac055236b9b7f27a9a82213b8a words.Add("bdir"); words.Add("birg"); // Bird is the word! var ag = new AnagramSolver("bird", words); var anagram = ag.FindAnagram("c75e59ac055236b9b7f27a9a82213b8a"); Assert.AreEqual("irdb", anagram); }
static void Main(string[] args) { /* * It solves the problem. * Event though it takes some time. * A number of optimizations. */ var ts = DateTime.Now.Ticks; var words = new List <String>(); try { StreamReader sr = new StreamReader("../../wordlist"); string line; while ((line = sr.ReadLine()) != null) { words.Add(line); } sr.Close(); } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); Console.ReadLine(); } var md5 = "4624d200580677270a54ccff86b9610e"; var challenge = "poultry outwits ants"; var anagramSolver = new AnagramSolver(challenge, words); var anagram = anagramSolver.FindAnagram(md5); Console.WriteLine(anagram); Console.WriteLine("Found in " + (DateTime.Now.Ticks - ts) / 10000000 + " secs"); Console.ReadLine(); }
static void Main(string[] args) { /* * It solves the problem. * Event though it takes some time. * A number of optimizations. */ var ts = DateTime.Now.Ticks; var words = new List<String>(); try { StreamReader sr = new StreamReader("../../wordlist"); string line; while ((line = sr.ReadLine()) != null) { words.Add(line); } sr.Close(); } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); Console.ReadLine(); } var md5 = "4624d200580677270a54ccff86b9610e"; var challenge = "poultry outwits ants"; var anagramSolver = new AnagramSolver(challenge, words); var anagram = anagramSolver.FindAnagram(md5); Console.WriteLine(anagram); Console.WriteLine("Found in " + (DateTime.Now.Ticks - ts) / 10000000 + " secs"); Console.ReadLine(); }