I have written all the code correctly, checked it several times
// receives a VALID guess, incriments turn, and returns count
FBullCowCount FBullCowGame::SubmitGuess(FString Guess)
{
// incriment the turn number
MyCurrentTry++;
// setup a return variable
FBullCowCount BullCowCount;
// loop through all letters in the guess
int32 HiddenWordLength = MyHiddenWord.length();
for (int32 MHWChar = 0; MHWChar < HiddenWordLength; MHWChar++) {
// compare letters against the hidden word
for (int32 GChar = 0; GChar < HiddenWordLength; GChar++) {
// if they match then
if (Guess[GChar] == MyHiddenWord[MHWChar]) {
if (MHWChar == GChar) { // if they're in the same place
BullCowCount.Bulls++; // incriment bulls
}
else {
BullCowCount.Cows++; // must be a cow
}
}
}
}
return BullCowCount;
}
I’ve tried to reset the bulls and cows to 0 before the first for loop, but it’s not working. Ben’s code is exactly the same as mine, but his code is running well and mine isn’t. I was using the 2017 version of VS. There are no errors or warnings popping up in the bottom tab. Please help me, I’m clueless.