diff --git a/BullCowGame/FBullCowGame.cpp b/BullCowGame/FBullCowGame.cpp index be7f169..4b46a0c 100644 --- a/BullCowGame/FBullCowGame.cpp +++ b/BullCowGame/FBullCowGame.cpp @@ -82,12 +82,18 @@ FBullCowCount FBullCowGame::SubmitValidGuess(FString Guess) bool FBullCowGame::IsIsogram(FString Word) const { // treat 0 and 1 letter words as isograms + if (Word.length() <= 1) { return true; } - // loop through all the letters of the word - // if the letter is in the map - // we do NOT have an isogram - // otherwise - // add the letter to the map as seen + TMap LetterSeen; // setup our map + for (auto Letter : Word) // for all letters of the word + { + Letter = tolower(Letter); // handle mixed case + if (LetterSeen[Letter]) {// if the letter is in the map + return false; // we do NOT have an isogram + } else { + LetterSeen[Letter] = true;// add the letter to the map + } + } return true; // for example in cases where /0 is entered } diff --git a/BullCowGame/FBullCowGame.h b/BullCowGame/FBullCowGame.h index e6f9591..9f3ce0d 100644 --- a/BullCowGame/FBullCowGame.h +++ b/BullCowGame/FBullCowGame.h @@ -36,6 +36,7 @@ class FBullCowGame void Reset(); // TODO make a more rich return value. FBullCowCount SubmitValidGuess(FString); + // ^^ Please try and ignore this and focus on the interface above ^^ private: // see constructor for initialisation diff --git a/Section_02.VC.db b/Section_02.VC.db index df1017c..8059dc0 100644 Binary files a/Section_02.VC.db and b/Section_02.VC.db differ