Because i made my IsGameWon() take an enum type my code for this challenge is different
void GameOver(EGameWinStatus WinConditions)
{
if (WinConditions == EGameWinStatus::Not_Enough_Bulls)
{
std::cout << "the hidden word was: " << BCGAME.GetHiddenWord() << std::endl;
std::cout << "Game is over now\n";
std::cout << "Thanks for playing!!\n" << std::endl;
}
else
{
std::cout << "Conglaturations YOUR WINNER!!\n";
}
}
and heres my PlayGame() method
void PlayGame()
{
int32 MAX_TURNS = BCGAME.GetMaxTries();
EGameWinStatus WinLoseConditions = EGameWinStatus::DEFAULT;
do
{
FText Guess = GetValidGuess();
FBullCowCount BULLS_COWS = BCGAME.SubmitValidGuess(Guess);
std::cout << "\nYou Got " << BULLS_COWS.Bulls << " Bulls and ";
std::cout << BULLS_COWS.Cows << " Cows\n\n";
WinLoseConditions = BCGAME.IsGameWon(BULLS_COWS);
switch (WinLoseConditions)
{
case EGameWinStatus::Not_Enough_Bulls:
std::cout << "Sorry, thats incorrect\n\n";
break;
case EGameWinStatus::DEFAULT:
std::cout << "Something went wrong updating bull count\n";
break;
default:
break;
}
} while ((WinLoseConditions != EGameWinStatus::Enough_Bulls) && (BCGAME.GetCurrentTry() <= MAX_TURNS));
GameOver(WinLoseConditions);
}
I also made a random number generator to select from a list of pre determined guess words. see here
My IsGameWon method using enum class and switch