private void Play() { IWordsRepository repo = new WordsRepository(new FileDictionaryLoader()); List <IGameplay> games = new List <IGameplay> { new Training(repo), new Match(repo) }; IGameplay game = ChooseGame(games); game.Run(this); }
public override void Run(WordsRepository repository) { string word; List <string> anagrams; UiHandler.WriteMessage(Description); UiHandler.WriteMessage(); UiHandler.WriteMessage("Please type a word to anagram"); word = UiHandler.InsertWord(); anagrams = repository.ProduceAnagrams(word); if (anagrams.Count() > 0) { if (anagrams.Count() == 1) { UiHandler.WriteMessage("The provided word does not have any anagram..."); } else { foreach (string w in anagrams) { if (!word.Equals(w)) { UiHandler.WriteMessage(w); } } } } else { UiHandler.WriteMessage("Sorry, the chosen word does not exist in the word repository..."); } UiHandler.WriteMessage(); UiHandler.WriteMessage(); }
public abstract void Run(WordsRepository repository);