Skip to content

Instantly share code, notes, and snippets.

@AndrewMilburn
Created March 26, 2017 17:40
Show Gist options
  • Save AndrewMilburn/f8640304d6358134ba05e47aeb6c2a93 to your computer and use it in GitHub Desktop.
Save AndrewMilburn/f8640304d6358134ba05e47aeb6c2a93 to your computer and use it in GitHub Desktop.
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