If it is Bull then Bull++ and skip to the next character. Execute Cow checking loop.
If it is Bull then Bull++ and skip to the next character. Else (not a Bull) execute Cow checking loop.
Does including ‘else’ affect the program at all?
Would it be better to write a function to check for Bulls and Cows separately?
[code]
FBullCowCount UBullCowCartridge::GetBullCows(const FString& Guess) const
{
FBullCowCount Counts;
for (int32 GuessIndex{ 0 }; GuessIndex < Guess.Len(); GuessIndex++)
{
if (Guess[GuessIndex] == HiddenWord[GuessIndex]) // Check Bulls
{
Counts.Bulls++;
continue;
}
else// Check Cows
{
for (auto HiddenChar : HiddenWord)
{
if (Guess[GuessIndex] == HiddenChar)
{
Counts.Cows++;
break;
}
}
}
}
return Counts;
}
[code]