コード例 #1
0
ファイル: BullsAndCowsGame.cs プロジェクト: qodetest/Projects
        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);
        }
コード例 #2
0
ファイル: BullsAndCowsGame.cs プロジェクト: qodetest/Projects
 private void ExecuteDefaultCommand(Scoreboard scoreBoard, string command)
 {
     try
     {
         Result guessResult = this.FindBullsAndCowsCount(command);
         this.DisplayCommandResult(scoreBoard, guessResult);
     }
     catch (ArgumentException e)
     {
         Console.WriteLine(e.Message);
     }
 }
コード例 #3
0
ファイル: BullsAndCowsGame.cs プロジェクト: qodetest/Projects
        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);
            }
        }
コード例 #4
0
ファイル: BullsAndCowsGame.cs プロジェクト: qodetest/Projects
 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);
     }
 }