void PlayGame() { int32 MaxTries = BCGame.GetMaxTries(); // Get a guess from the player and repeat it back to them. while(!BCGame.IsGameWon() && BCGame.GetCurrentTry() <= MaxTries) { FText Input = GetGuess(); FBullCowCount BullCowCount = BCGame.SubmitValidGuess(Input); std::cout << "Number of Bulls: " << BullCowCount.Bulls << std::endl; std::cout << "Number of Cows: " << BullCowCount.Cows << std::endl << std::endl; } PrintGameSummary(BCGame.IsGameWon()); return; }
// Plays a single game to completion void PlayGame() { BCGame.Reset(); int32 MaxTries = BCGame.GetMaxTries(); //Loop asking for guesses while the game is NOT won and there are still turns while (!BCGame.IsGameWon() && BCGame.GetCurrentTry() <= MaxTries) { FText Guess = GetValidGuess(); FBullCowCount BullCowCount = BCGame.SubmitValidGuess(Guess); std::cout << "Bulls = " << BullCowCount.Bulls; std::cout << ", Cows = " << BullCowCount.Cows << "\n\n"; } PrintGameSummary(); }
// plays a single game to completion void PlayGame() { BCGame.Reset(); int32 MaxTries = BCGame.GetMaxTries(); // loop asking for guesses while the game // is NOT won and there are still tries remaining while(!BCGame.IsGameWon() && BCGame.GetCurrentTry() <= MaxTries) { FText Guess = GetValidGuess(); // submit valid guess to the game, and receive counts FBullCowCount BullCowCount = BCGame.SubmitValidGuess(Guess); PrintGuess(BullCowCount); } return; }
// plays a single game to completion void PlayGame() { BCGame.Reset(); int32 MaxTries = BCGame.GetMaxTries(); while (!BCGame.IsGameWon() && BCGame.GetCurrentTry() <= MaxTries) { FText Guess = GetValidGuess(); // submit valid guess to the game, and receive counts FBullCowCount BullCowCount = BCGame.SubmitValidGuess(Guess); std::cout << "Bulls = " << BullCowCount.Bulls; std::cout << ". Cows = " << BullCowCount.Cows << "\n\n"; } PrintGameSummary(); return; }
// plays a single game to completion void PlayGame() { BCGame.Reset(); int32 MaxTries = BCGame.GetMaxTries(); // loop asking for guesses while the game // is NOT won and there are still tries remaining while (!BCGame.IsGameWon() && BCGame.GetCurrentTry() <= MaxTries) { FText Guess = GetValidGuess(); // submit valid guess to the game, and receive counts FBullCowCount BullCowCount = BCGame.SubmitValidGuess(Guess); std::cout << "Bulls = " << BullCowCount.Bulls; std::cout << ". Cows = " << BullCowCount.Cows << "\n\n"; } PrintGameSummary(); return; }
void PlayGame() { BCGame.Reset(); int MaxTries = BCGame.GetMaxTries(); //loop asking for guesses while the game is NOT won while (!BCGame.IsGameWon() && BCGame.GetCurrentTry() <= MaxTries) { FText Guess = GetGuess(); //submit valid guess to game FBullCowCount BullCowCount = BCGame.SubmitValidGuess(Guess); //print number of bulls and cows std::cout << "Bulls = " << BullCowCount.Bulls; std::cout << " Cows = " << BullCowCount.Cows << "\n\n"; std::cout << "Your guess was: " << Guess << std::endl; std::cout << std::endl; } PrintGameSummary(); return; }