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); }
private void ExecuteDefaultCommand(Scoreboard scoreBoard, string command) { try { Result guessResult = this.FindBullsAndCowsCount(command); this.DisplayCommandResult(scoreBoard, guessResult); } catch (ArgumentException e) { Console.WriteLine(e.Message); } }
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); } }
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); } }