Possible bug

I’ve checked over my code, and as far as I can see it is the same… However if I enter a guess that is longer than the condition in the if else satement in with a capital letter at the end, it gives me the wrong error.
EGuessStatus FBullCowGame::CheckGuessValidity(FString Guess) const
else if (Guess.length() != GetHiddenWordLength())

One way I’ve found to overcome this is put this condition first, then check for isogram then check for capitals, but Ben said the order of the condition statements should not matter.
I’m thinking this is probably my fault!! Can anyone help please!!

Ok so I’m convinced there is a bug.
If you enter a word longer than the length of MyHiddenWord.Length() but capitalise any leter after this specidfied length then game asks for all lowercase letters to be entered - it should ask for the correct size word to be entered.
For me the checks should be correct length first regardless of capitals or repeating.

Can anyone help please.

My solution is below and it works as expected

EGuessStatus FBullCowGame::CheckGuessValidity(FString Guess) const
{
if(!IsIsogram(Guess))//if guess isnt an isogram
{
if(Guess.length() != GetHiddenWordLength())
{
return EGuessStatus::Wrong_Length;
}
else
{
return EGuessStatus::Not_Isogram;
}
}
if(!IsLowerCase(Guess)) //if the guess isnt all lowercase
{
if(Guess.length() != GetHiddenWordLength())
{
return EGuessStatus::Wrong_Length;
}
else
{
return EGuessStatus::Not_Lowercase;// TODO write function
}
}
if(Guess.length() != GetHiddenWordLength())
{
return EGuessStatus::Wrong_Length; //if guess length is wrong
}

return EGuessStatus::OK;

}// end function

  1. fails isogram then checks for correct length - if wrong length user is informed it is wrong length, if repeating characters the user is informed.
  2. fails lowercase then checks for correct length - if wrong length user is informed it is wrong length, if capital characters the user is informed.
  3. wrong length and none of above - user informed
  4. No condition satisfied then valid guess

Privacy & Terms