FBullCowCount FBullCowGame::SubmitGuess(FString Guess)
{
//increment the turn
MyCurrentTry++;
// setup a return structure
FBullCowCount BullCowCount;
int32 HiddenWordLenght = MyHiddenWord.length();
//loop through all letters in the guess
for (int32 MHWChar = 0; MHWChar < HiddenWordLenght; MHWChar++) {
//compare letters against the hidden word
for (int32 GChar = 0; GChar < HiddenWordLenght; GChar++) {
//if they match
if (Guess[MHWChar] == MyHiddenWord[MHWChar]) { //watch added here
//increment bulls if they are in the same place
if (MHWChar == GChar) {
BullCowCount.Bulls++;
}
else {
//increment cows if they are not
BullCowCount.Cows++;
}
}
}
}
return BullCowCount;
}
Also everything blow up with debug assert error if the user entered string is longer that the hidden word, is this by design currently?