Пример #1
0
        public void SetupAndStartNewGame()
        {
            Console.WriteLine(_renderBanner.CreateBannerForGame());

            // Load the Dictionary
            var wordList = _fileReader.LoadDictionary().ToList();

            // Select and print random word
            var randomWord = _randomWordSelector.SelectRandomWordFromDictionary(wordList);

            Console.WriteLine("Lets play Hangman!");

            // Assemble the Hangman Object
            var hangmanObject = new Hangman
            {
                WordToGuess        = randomWord,
                LettersInWordSplit = _assembleGuessedLetters.AssembleTheGuessedLetters(randomWord)
            };

            Console.WriteLine("Word to guess: {0}", _displayWord.RenderWordView(hangmanObject.LettersInWordSplit));

            // Perform Hangman Logic
            _mainGame.Run(hangmanObject);

            Console.Clear();

            // Results Screen
            _resultsScreen.RunResults(hangmanObject);

            PlayAgainQuestion();
        }
Пример #2
0
 private void CreateView(Hangman hangmanObject)
 {
     Console.WriteLine(_renderHangman.SwitchAndDisplayHangmanImage(hangmanObject.GuessesLeft));
     Console.WriteLine("Word to guess: {0}",
                       _displayWord.RenderWordView(hangmanObject.LettersInWordSplit));
     Console.WriteLine("Already guessed: {0}", string.Join(", ", hangmanObject.AlreadyGuessedLetters));
 }