So I somewhat understand the code, but does GChar compare each of its elements to all 5 of the HWChar’s elements via the “if statement”? Or does it compare say Guess element 0 to HiddenWord element 0 at the same time since they’re both loops running at the same time, then cycle to comparing element 1 to element 1?
for (int32 HWChar = 0; HWChar < HiddenWordLength; HWChar++) // initializing HWChar (hidden word)
{
for (int32 GChar = 0; GChar < HiddenWordLength; GChar++) // initializing GChar (guess)
{
// if they match then
if (Guess[GChar] == MyHiddenWord[HWChar]) { // If ANY element of Guess matches MyHiddenWord then
if (HWChar == GChar) { // check to see if they're in the same place
BullCowCount.Bulls++; // must be a bull
}
else { // any other match, that's not a specific element match, has to be a cow
BullCowCount.Cows++; // must be a cow
}
}
}
}