Hey, i have a problem of making the code work properly,
the Bulls and Cows always stay at the same count depending on the Hidden Word. When the Hidden Word is 1 letter - there are 1 Bull 0 Cows, when the Hidden Word is 4 letters - there are 4 Bulls and 12 Cows, and so on, and it is like the Guess is not even taken into account.
I would appreciate the help,
Thank You.
Here is The Code
void FBullCowGame::Reset()
{
constexpr int32 MAX_TRIES = 8;
const FString HIDDEN_WORD = "death";
MyHiddenWord = HIDDEN_WORD;
MyMaxTries = MAX_TRIES;
MyCurrentTries = 1;
}
bool FBullCowGame::IsGameWon() const
{
return false;
}
FBullCowCount FBullCowGame::SubmitGuess(FString Guess)
{
MyCurrentTries++;
//okresla jaki dostaje return
FBullCowCount BullCowCount;
//loopuje kazda litere w slowie
int32 HiddenWordLength = MyHiddenWord.length();
for (int32 MHWChar = 0; MHWChar < HiddenWordLength; MHWChar++)
{
for (int32 GChar = 0; GChar < HiddenWordLength; GChar++)
{
if (Guess[MHWChar] = MyHiddenWord[MHWChar]);
{ if (MHWChar == GChar) {
BullCowCount.Bulls++;
}
else
{
BullCowCount.Cows++;
}
}
}
}
return BullCowCount;
}