/// <summary> /// Displays instructions to the user. /// </summary> public void DisplayGuessIterationInstructions() { var guessInstructions = "If your number is: higher, press Up arrow key, or if it is lower, press Down arrow key."; _displayHandler.AppendInstructions(guessInstructions); _displayHandler.DisplayInstructions(); }
/// <summary> /// Validates the user's guess against the value that the computer picked. /// </summary> /// <param name="numberToGuess">The number that the player believes the computer has picked.</param> /// <returns>Boolean. Representing if the user guess correctly or not.</returns> public bool GuessNumber(int numberToGuess) { //ToDo: set up Resource file for hard coded text var success = numberToGuess == _number; var successMessage = success ? "correct!" : "incorrect."; var higherOrLowerMessage = ""; if (numberToGuess < _number) { higherOrLowerMessage = "Your number is too low, try a higher number next time."; } else if (numberToGuess > _number) { higherOrLowerMessage = "Your number is too high, try a lower number next time."; } var message = $"Your guess was {successMessage} {higherOrLowerMessage}"; _displayHandler.Debug($"Computer's guess is: {_number}"); _displayHandler.DisplayInstructions(message); return(success); }