public void Play() { bool x = false; Jumble jMB = new Jumble(); jMB.DisplayScramble(); string result = jMB.DisplayScramble(); Console.WriteLine(); Console.WriteLine("The scrambled word is: " + result); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Now it's your turn to take a guess!"); do { string answer = TakeAGuess(); bool check = jMB.CompareString(answer); x = check; if (check == false) { Console.WriteLine(); Console.WriteLine("Incorrect answer. Please try again!"); } else { Console.WriteLine(); Console.WriteLine("Your answer, " + answer + ", was correct!"); } } while (x == false); }
static void Main(string[] args) { Info myInfo = new Info(); myInfo.DisplayInfo("2: Jumble Game"); Jumble newJumble = new Jumble(); newJumble.PlayAgain(); }
public void Play() { int tries = 0; Jumble game = new Jumble(); game.GenerateRandomHiddenWord(); game.ScrambleCurrentHiddenWord(); while (!game.CompareString(TakeAGuess(game.CurrentScrambledWord + "\nEnter a guess: "))) tries++; Console.WriteLine("Correct! It took you " + tries + " tries to find that."); playAgain(); }