예제 #1
0
        private static string CreateChain(string startWord, string endWord)
        {
            var chains = new BreadthChains()
            {
                Dictionary = GetDictionary()
            };

            return(chains.Create(startWord, endWord));
        }
예제 #2
0
        public void WrongPath()
        {
            //  AAA => AAC => BAC => BBC => BBE
            //  AAA => AAB

            var chains = new BreadthChains()
            {
                Dictionary = new HashSet <string>()
                {
                    "AAA", "AAC", "BAC", "BBC", "AAB", "BBE"
                }
            };
            var chain = chains.Create("AAA", "BBE");

            var split = chain.Split(new[] { "->" }, System.StringSplitOptions.RemoveEmptyEntries);
        }
예제 #3
0
        private void cmdBreadth_Click(object sender, EventArgs e)
        {
            var startWord = this.txtFrom.Text.Trim().ToUpper();
            var endWord   = this.txtTo.Text.Trim().ToUpper();


            var sw = new Stopwatch();

            sw.Start();

            var chains = new BreadthChains()
            {
                Dictionary = GetDictionary(startWord.Length)
            };

            var chain = chains.Create(startWord, endWord);

            sw.Stop();

            this.lblAnswer.Text = "Breadth :: " + chain + $" ({Math.Round(sw.Elapsed.TotalSeconds, 2)}s)";
        }