/// <summary> /// /// </summary> public void PlayTheGame() { Console.Clear(); Console.WriteLine($"\nHello {DecisionsAndFormattingProgram.GetName()}. Let's play the game!"); Console.WriteLine($"Try to guess a number between {MIN} and {MAX - 1}."); isTrue = false; int number = GetRandomNumber(); attempts = 0; do { Console.ForegroundColor = ConsoleColor.Green; attempts++; userInput = DecisionsAndFormattingProgram.GetUserInput(); if (number == userInput) { Console.Write($"\nThat is correct answer. It took you {attempts} "); Console.Write((attempts > 1) ? "times." : "time."); Console.WriteLine("\nPlease press ENTER to continue..."); Console.ReadLine(); isTrue = true; } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Wrong, please try again."); } }while (!isTrue); }
/// <summary> /// Start the new Game /// </summary> public void PlayTheGame() { Console.Clear(); Console.WriteLine($"\nHello {DecisionsAndFormattingProgram.GetName()}. Let's do some formatting in C#!"); RunApp(); }
/// <summary> /// /// </summary> private void DisplayName() { Console.WriteLine($"Your current name is: {DecisionsAndFormattingProgram.GetName()}"); Console.WriteLine("\nPlease press ENTER to continue..."); Console.ReadLine(); }