public void PlayGame() { string guess; Console.WriteLine($"The secret number is {_secret}"); while (true) { Console.Write("The guess number is: "); guess = Digits.GetPossibleAnswer(_numbers); System.Threading.Thread.Sleep(1000); var counts = CountBullsAndCows(guess, _secret); Console.WriteLine($"{counts.Bulls} bulls"); Console.WriteLine($"{counts.Cows} cows"); if (counts.Bulls == 4) { Console.WriteLine("Congratulations! You won!"); Console.WriteLine($"The number is {guess}"); break; } ModifyList(_numbers, guess, counts.Cows, counts.Bulls); Console.WriteLine($"There are {_numbers.Count} possible numbers remaining."); System.Threading.Thread.Sleep(4000); } }
public Game() { _secret = Digits.GetRandomNumber(); _numbers = Digits.GetAllUniqueNumbers(); }