static void Main(string[] args) { string[] words = File.ReadAllLines(@"dictionary.txt", Encoding.UTF8); Random random = new Random(); string word = words[random.Next(words.Length)]; IHangmanUI ui = new HangmanUI(); Game game = new Game(word); while (game.InProgress()) { ui.ShowMaskedWord(word, game.guesses); ui.ShowGuesses(game.guesses); game.MakeGuess(ui.RequestGuess()); } if (game.IsWon()) { ui.ShowGameWon(); } else { ui.ShowGameLost(word); } }
static void Main(string[] args) { HangmanUI ui = new HangmanUI(); ui.Run(); }