Before i even started watching the video, i had to see if i could figure it out, so i did.
here is my enum class in FBullCowGame.h
enum class EGameWinStatus{Not_Enough_Bulls, Enough_Bulls, DEFAULT};
i changed the type of IsGameWon() here
EGameWinStatus IsGameWon(FBullCowCount)const;
Its definition
EGameWinStatus FBullCowGame::IsGameWon(FBullCowCount Bull_Count) const
{
if (Bull_Count.Bulls == GetHiddenWordLength()) { return EGameWinStatus::Enough_Bulls;}
else { return EGameWinStatus::Not_Enough_Bulls;}
}
and in main.cpp here is my PlayGame() function
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 << "try again\n";
break;
case EGameWinStatus::DEFAULT:
std::cout << "Something went wrong updating bull count\n";
break;
default:
std::cout << "YOU WON!!!!\n";
break;
}
} while ((WinLoseConditions != EGameWinStatus::Enough_Bulls) && (BCGAME.GetCurrentTry() <= MAX_TURNS));
}
This solution is very different from Ben’s, but I am very satisfied with my code,(and skills at this point)and the compiler see no warnings.
Thoughts, opinions?