Skip to content
Snippets Groups Projects
Commit 3294a5c3 authored by Fabian Mueller's avatar Fabian Mueller
Browse files

Tutorial Hotfix

parent 72637684
No related branches found
No related tags found
No related merge requests found
......@@ -12,21 +12,22 @@ namespace Mastermind
Console.WriteLine("The goal of this game is to crack the (randomly) generated Code of which the Length will the determined by the chosen difficulty.\nIn this tutorial the Code will have a length of 4.\n Start by guessing 4 different Numbers with the Range 0 - 9 (0 and 9 are included).");
foreach (int n in tutorialGuess) //fill array that saves guesses of the user
{
int input = 0;
int input = 0; //used for user input
bool ret_1 = false;
do
{
ret_1 = int.TryParse(Console.ReadLine(), out input);
if (ret_1) //ret_1 is a bool, when false if is false; when true if is true
ret_1 = int.TryParse(Console.ReadLine(), out input); //check if user input a number
if (ret_1 == false || input.ToString().Length != 1) //check if user input is a number and if it is a single digit
{
ret_1 = true;
tutorialGuess[n] = input;
Console.WriteLine("Please write a single number between 0 and 9."); //if user didn't input Number --> display message to guide User
}
Console.WriteLine("Please Write a Number between 0 and 9.");
}
while (ret_1); //ret_1 is a bool, when false if is false; when true if is true
while (ret_1 == false); //repeat if user didn't input a Number
//when user did input a Number --> write in array that saves user input
tutorialGuess[n] = input;
}
Console.WriteLine($"{tutorialGuess[0]}, {tutorialGuess[1]}, {tutorialGuess[2]}, {tutorialGuess[3]}");
Console.WriteLine($"{tutorialGuess[0]}, {tutorialGuess[1]}, {tutorialGuess[2]}, {tutorialGuess[3]}");//Diese Meldung wird später noch herausgenommen.
Console.WriteLine("Press Q to quit.");//Diese Meldung wird später noch herausgenommen.
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment