Ejemplo n.º 1
0
        /// <summary>
        /// Run the algorithm multiple times via user input.
        /// </summary>
        private static void RunAlgorithmUserInput()
        {
            bool   running            = true;
            string dictionaryFilePath = GetUserInputPath("\nPlease enter a path to a vocabulary file: ", false);
            string resultsFilePath    = GetUserInputPath("\nPlease enter a path to a results file: ", true);
            string startWord          = GetUserInputWord("\nPlease enter a start word: ");
            string endWord            = GetUserInputWord("\nPlease enter an end word: ");

            WordStepAlgorithm wordDictionary = new WordStepAlgorithm(dictionaryFilePath, startWord, endWord, resultsFilePath);

            wordDictionary.RunAlgorithm();

            do
            {
                string option = GetUserOption("\nFind a word chain for more words? Y/N");
                if (option == "N")
                {
                    running = false;
                    break;
                }
                wordDictionary.StartWord = GetUserInputWord("\nPlease enter a start word: ");
                wordDictionary.EndWord   = GetUserInputWord("\nPlease enter an end word: ");
                wordDictionary.RunAlgorithm();
            } while (running);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Run the algorithm once using command line parameters.
        /// </summary>
        private static void RunAlgorithm(string[] parameters)
        {
            WordStepAlgorithm wordDictionary = new WordStepAlgorithm(parameters[0], parameters[1], parameters[2], parameters[3]);

            wordDictionary.RunAlgorithm();
            Console.WriteLine("Press enter to terminate program.");
            Console.ReadLine();
        }