Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            HangmanUI ui = new HangmanUI();

            ui.Run();
        }