-
-
Save jouytrew/9a717f86b0d0d09a0be18e57c6173b18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Receives a VALID guess, increments turn, and returns count | |
FBullCowCount FBullCowGame::SubmitGuess(FString Guess) | |
{ | |
// increments turn # | |
MyCurrentTry++; | |
// setup a return variable | |
FBullCowCount BullCowCount; | |
// loop through all letters | |
int32 HiddenWordLength = MyHiddenWord.length(); | |
for (int32 i = 0; i < HiddenWordLength; i++) | |
{ | |
// compare against word | |
for (int32 j = 0; j < HiddenWordLength; j++) | |
{ | |
// If they match | |
if (Guess[i] == MyHiddenWord[j]) | |
{ | |
(i == j) ? BullCowCount.Bulls++ : BullCowCount.Cows++; | |
break; | |
} | |
} | |
} | |
return BullCowCount; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment