Created
March 26, 2017 17:40
-
-
Save AndrewMilburn/f8640304d6358134ba05e47aeb6c2a93 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
bool FBullCowGame::IsIsogram(FString Guess) const | |
{ | |
// treat 0 & 1 letter words as isograms | |
if (Guess.length() <= 1) { return true; } | |
// setup map | |
TMap<char, bool> LetterSeen; | |
// loop through each letter in guess | |
for (auto Letter : Guess) | |
{ | |
Letter = tolower(Letter); // Allows mixed Case Guesses | |
if (LetterSeen[Letter]) | |
// we do NOT have isogram | |
return false; | |
else | |
// add it to the map | |
LetterSeen[Letter] = true; | |
} | |
return true; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment