예제 #1
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambledWords)
        {
            //read the list of words in the wordlist.txt file (unscrambled words)
            string[] wordList = _fileReader.Read("wordlist.txt");

            //call a word matcher method, to get a list of MatchedWord structs
            List <MatchedWord> matchedWords = _wordMatcher.Match(scrambledWords, wordList);

            //display the match - print to  console

            if (matchedWords.Any())
            {
                //loop through matchWords and print contents of structs
                //foreach

                foreach (var matchedWord in matchedWords)
                {
                    //write to console
                    //MATCH FOUND FOR act: cat
                    Console.WriteLine("MATCH FOUND FOR {0}: {1}", _wordMatcher.Match(scrambledWords, wordList));
                }
            }
            else
            {
                //NO MATCHES HAVE BEEN FOUND
                Console.WriteLine("NO MATCHES HAVE BEEN FOUND");
            }
        }
예제 #2
0
        private static void DisplayMatchScrambledWords(string[] scrambledWords)
        {
            try
            {
                // Get List of words to run unscrambler words against
                var wordList = FileReader.Read(WordListFileName);

                var matchWords = WordMatcher.Match(scrambledWords, wordList);

                if (matchWords.Any())
                {
                    foreach (var matchword in matchWords)
                    {
                        Console.WriteLine($"Match found for {matchword.ScrambledWord}: {matchword.Word}");
                    }
                }
                else
                {
                    Console.WriteLine(Constant.MatchNotFound);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(Constant.AppScrambledWordsLoadError + ex.Message);
            }
        }
예제 #3
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambledWords)
        {
            //read the list of words in the wordlist.txt file
            string[] wordList = _fileReader.Read(constants.wordListFile);

            //call a word matcher method, to get a list of MatchedWords structs
            List <MatchedWord> matchedWords = _wordMatcher.Match(scrambledWords, wordList);

            //display the matches

            if (matchedWords.Any())
            {
                //loop through List and print to console the contents of the structs
                //foreach
                foreach (var matchedWord in matchedWords)
                {
                    //MATCH FOUND FOR act: cat
                    Console.WriteLine(constants.matchFound + matchedWord.ScrambledWord + " : " + matchedWord.Word);
                }
            }
            else
            {
                Console.WriteLine(constants.matchNotFound);
            }
        }
예제 #4
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambleWords)
        {
            //read the list of words in the wordlist.txt file (unscrambled words)
            string[] wordList = _fileReader.Read("wordlist.txt");

            //call a word matched method, to get a list of MatchedWord structs
            List <MatchedWord> matchedWords = _wordMatcher.Match(scrambleWords, wordList);

            //display the match - print to console

            if (matchedWords.Any())
            {
                //loop through matchedWords and print to console the contents of the structs
                //foreach

                foreach (var matchedWord in matchedWords)
                {
                    //write to console
                    //Match found for act: cat
                    Console.WriteLine(_constants.MatchFoundString(), matchedWord.ScrambledWord, matchedWord.Word);
                }
            }
            else
            {
                //No Matches have been found
                Console.WriteLine(_constants.NoMatchesFoundString());
            }
        }
        public static void DisplayScrambledWords(string[] scrambledWords)
        {
            string[]           wordList     = _fileReader.Read(Constants.fileName);
            List <MatchedWord> matchedWords = _wordMatcher.Match(scrambledWords, wordList);

            if (matchedWords.Any())
            {
                foreach (var word in matchedWords)
                {
                    Console.WriteLine(Constants.matchesFound, word.ScrambledWord, word.Word);
                }
            }
            else
            {
                Console.WriteLine(Constants.matchesNotFound);
            }
        }
예제 #6
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambledWords)
        {
            //read the list of words in the wordlist.txt file (unscrambled words)
            string[] wordList = _fileReader.Read("wordlist.txt");

            //call a word matcher method, to get a list of MatchedWord structs
            List <MatchedWord> matchedWords = _wordMatcher.Match(scrambledWords, wordList);

            //display the match - print to console
            if (matchedWords.Any())
            {
                //loop through matchedWords and print to console the contents of the structs
                for (int i = 0; i < matchedWords.Count; i++)
                {
                    //foreach
                    foreach (var matchedWord in matchedWords)
                    {
                        Console.WriteLine("MATCH FOUND FOR {0} : {1} ", matchedWord.ScrambledWord, matchedWord.Word);
                        //matched found for act: cat
                        //matched found for act: cat
                    }
                }

                //write to console

                //matched found for act: cat
            }
            else
            {
                //no matches have been found
                Console.WriteLine();
            }



            MatchedWord BuildMatchedWord(string scrambledWord, string word)
            {
                MatchedWord matchedWord = new MatchedWord
                {
                    ScrambledWord = scrambledWord,
                    Word          = word
                };

                return(matchedWord);
            }
        }
예제 #7
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambledWords)
        {
            string[]           wordList     = _fileReader.Read(Constants.WordListFileName);
            List <MatchedWord> matchedWords = _wordMatcher.Match(scrambledWords, wordList);

            if (matchedWords.Any())
            {
                foreach (var matchedWord in matchedWords)
                {
                    Console.WriteLine(Constants.MatchFound, matchedWord.ScrambledWord, matchedWord.Word);
                }
            }
            else
            {
                Console.WriteLine(Constants.MatchNotFound);
            }
        }
        private static void DisplayMatchedUnscrambledWords(string[] scrambledWords)
        {
            string[] wordList = FileReader.Read(wordListFileName);

            List <MatchedWord> matchedWords = WordMatcher.Match(scrambledWords, wordList);

            if (matchedWords.Any())
            {
                foreach (var matchedWord in matchedWords)
                {
                    Console.WriteLine($"Match found for {matchedWord.ScrambledWord} : {matchedWord.Word}");
                }
            }
            else
            {
                Console.WriteLine(MatchNotFound);
            }
        }
예제 #9
0
        private static void DisplayMatchedScrambledWords(string[] scrambledWords)          //Create a method to show the user of any matches found
        {
            string[] wordList = fileReader.Read(Constants.WORDLIST);                       //Call the FileReader classes's Read method to retreive the word list from the Constants namespace

            List <MatchedWord> matchedWords = wordMatcher.Match(scrambledWords, wordList); //Call the WordMatcher classes's Match method to test for any matches

            if (matchedWords.Any())                                                        //If the Match method got any matches
            {
                foreach (MatchedWord matchesFound in matchedWords)                         //Use a foreach loop to cycle through the matches found
                {
                    Console.WriteLine("A match was found for the scrambled word {0}:\t{1}", matchesFound.ScrambledWord, matchesFound.Word);
                }
            }
            else //If no matches were made
            {
                Console.WriteLine("The object did not contain any matched words. oop");
            }
        }
예제 #10
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambledWords)
        {
            string[] wordList = _fileReader.Read(wordListFileName);

            List <MatchedWord> matchedWords = _wordMatcher.Match();

            if (matchedWords.Any())
            {
                foreach (var matchedWord in matchedWords)
                {
                    Console.WriteLine("Match found for {0}: {1}", matchedWord.ScrambledWord, matchedWord.Word);
                }
            }
            else
            {
                Console.WriteLine("No matches have been found.");
            }
        }
        public static void DisplayMatchedWords(string[] splitScrambledWords)
        {
            string[] wordsList = FileReader.Read(worldListFileName);

            List <MatchWord> matchWords = WordMatcher.Match(splitScrambledWords, wordsList);

            if (matchWords.Any())
            {
                foreach (var matchedWord in matchWords)
                {
                    Console.WriteLine($"Match found for scrambled word {matchedWord.ScrambleWord} : {matchedWord.Word}");
                }
            }
            else
            {
                Console.WriteLine("NO MATCH FOUND!");
            }
        }
예제 #12
0
        private static void DisplayMatchedScrambledWords(string[] scrambledWords)
        {
            string[]           wordList     = fileReader.read(@"C:\Users\lpsim\Source\Repos\Word-Unscrambler\WordUnscrambler\wordlist.txt");
            List <MatchedWord> matchedWords = wordMatcher.Match(scrambledWords, wordList);
            int i = 1;

            if (matchedWords.Any())
            {
                foreach (var matchedWord in matchedWords)
                {
                    Console.WriteLine("Match " + i + " has been found for {0} {1}", matchedWord.ScrambledWord, matchedWord.Word);
                    i++;
                }
            }
            else
            {
                Console.WriteLine("No match. Please retry!");
            }
        }
예제 #13
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambleWords)
        {
            Constants constants = new Constants();

            string[]            wordList     = _fileReader.Read("wordlist.txt");
            List <MatchedWords> matchedWords = _wordMatcher.Match(scrambleWords, wordList);

            if (matchedWords.Any())
            {
                foreach (var mWord in matchedWords)
                {
                    Console.WriteLine(constants.Sentences(8), mWord.ScrambleWord, mWord.Word);
                }
            }
            else
            {
                Console.WriteLine(constants.Sentences(9));
            }
        }
예제 #14
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambledWords)
        {
            // use read method on custom fileReader object
            // create a list of matched words using match method on custom wordMatcher object
            // if there are any matched words in list, then show matches, otherwise display message
            string[] wordList = _fileReader.Read(Constants.WordListFilename);

            List <MatchedWord> matchedWords = _wordMatcher.Match(scrambledWords, wordList);

            if (matchedWords.Any())
            {
                foreach (var matchedWord in matchedWords)
                {
                    Console.WriteLine(Constants.MatchFound, matchedWord.ScrambledWord, matchedWord.Word);
                }
            }
            else
            {
                Console.WriteLine(Constants.MatchNotFound);
            }
        }
예제 #15
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambledWords)
        {
            string[] wordList = _fileReader.Read("wordList.txt");

            List <MatchedWord> matchedWords = _wordMatcher.Match(scrambledWords, wordList);

            if (matchedWords == null)
            {
                Console.WriteLine(Constants.file_path_invalid);
            }
            else if (matchedWords.Any())
            {
                foreach (var matchedWord in matchedWords)
                {
                    Console.WriteLine(Constants.match_found, matchedWord.ScrambledWord, matchedWord.Word);
                }
            }
            else
            {
                Console.WriteLine(Constants.no_match_found);
            }
        }
예제 #16
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambleWords)
        {
            //read the list of words in the wordlist.txt file (unscrambled words)
            string[] wordList = _fileReader.Read(Constant.fileName);

            //call a word matcher method, to get a list of MatchedWord structs
            List <MatchedWord> matchedWords = _wordMatcher.Match(scrambleWords, wordList);

            //display the match - print to console

            if (matchedWords.Any())
            {
                //loop throught matchedWords and print to console the content of the structs
                //foreach
                foreach (var matchedWord in matchedWords)
                {
                    //write to console
                    //MATCH FOUND FOR "ACT" = CAT
                    Console.WriteLine("MATCH FOUND FOR " + matchedWord.ScrambledWord + " : " + matchedWord.Word);
                }
            }
            else
            {
                Console.WriteLine(Constant.notMatchFound);
            }
            Console.WriteLine(Constant.askContinue);
            String response = Console.ReadLine();

            if (response.ToUpper() == Constant.yes)
            {
                isContinue = true;
            }
            else if (response.ToUpper() == Constant.no)
            {
                isContinue = false;
            }
        }
예제 #17
0
        private static void DisplayMatchedUnscrambledWords(string[] scrambledWords)
        {
            //Read the list of words in the wordlist.txt (unscrambled words)
            string[] wordList = _fileReader.Read(Constants.FilePath);

            //Call a word matched method, to get a list of MatchedWord structs
            List <MatchedWord> matchedWords = _wordMatcher.Match(scrambledWords, wordList);

            //Display the match - print to console
            if (matchedWords.Any())
            {
                //Loop through matchedWords and print to console the contents of the structs
                foreach (var matchedWord in matchedWords)
                {
                    //Write to console all the matched words
                    Console.WriteLine(Constants.MatchFound + matchedWord.ScrambledWord + " : " + matchedWord.Word);
                }
            }
            else
            {
                //Print "NO MATCH FOUND" if there are no matched words
                Console.WriteLine(Constants.NoMatchFound);
            }
        }