So My problem is that my bulls and cows iterating seems to be unaffected by the code running here.
I’m not sure why, I’ve checked that it’s being called on my main.cpp and it is, and my code seems to be identical to the code in the tutorial video.
I’m not quite sure what’s causing my problem, I have noticed that the square brackets highlight and turn green in the video, and not in my code. but as far as i can see, that is the only difference.
Thanks, here’s the code I have:
FBullCowCount FBullCowGame::SubmitGuess(FString Guess)
{
//increment the turn number
MyCurrentTry++;
//setup return variable
FBullCowCount BullCowCount;
//loop through all letters in the guess
int32 HiddenWordLength = MyHiddenWord.length();
for (int32 HWChar = 0; HWChar < HiddenWordLength; HWChar++)
{
for (int32 GChar = 0; GChar < HiddenWordLength; GChar++)
{
if (Guess[HWChar] == MyHiddenWord[HWChar])
{
if (HWChar == GChar)//if they are in the same place
{
BullCowCount.Bulls++; // increment bulls
}
else
{
BullCowCount.Cows++; // increment cows
}
}
}
}
return BullCowCount;
}