Beispiel #1
0
        private void DisplayResultWithoutCheats(Scoreboard scoreBoard)
        {
            string attemptStr = GetPluralOrSingularOfWord(this.GuessesCount, "attempt");

            Console.WriteLine(NUMBER_GUESSED_WITHOUT_CHEATS_MSG, this.GuessesCount, attemptStr);
            System.Diagnostics.Process.Start("https://www.youtube.com/playlist?list=PL1CTk64TxYtAKlTusWjlfsnXgYIb5XsDZ");
            scoreBoard.AddPlayerToScoreboard(this.GuessesCount);
        }
Beispiel #2
0
 private void ExecuteDefaultCommand(Scoreboard scoreBoard, string command)
 {
     try
     {
         Result guessResult = this.FindBullsAndCowsCount(command);
         this.DisplayCommandResult(scoreBoard, guessResult);
     }
     catch (ArgumentException e)
     {
         Console.WriteLine(e.Message);
     }
 }
Beispiel #3
0
        public void Play()
        {
            Scoreboard scoreBoard = new Scoreboard();

            DisplayWelcomeMessage();
            while (true)
            {
                string command = BullsAndCowsGame.ReadUserCommand();
                if (command == "exit")
                {
                    Console.WriteLine(GOOD_BYE_MSG);
                    return;
                }
                this.ExecuteCommand(scoreBoard, command);
            }
        }
Beispiel #4
0
 private void DisplayCommandResult(Scoreboard scoreBoard, Result guessResult)
 {
     if (guessResult.Bulls == GUESS_NUMBER_LENGHT)
     {
         if (this.Cheats == 0)
         {
             DisplayResultWithoutCheats(scoreBoard);
         }
         else
         {
             DisplayResultWithCheats();
         }
         Console.Write(scoreBoard);
         this.GetStartValues();
     }
     else
     {
         Console.WriteLine(guessResult);
     }
 }