diff --git a/src/Boggle.cpp b/src/Boggle.cpp index e21ecd2..4cc46bb 100755 --- a/src/Boggle.cpp +++ b/src/Boggle.cpp @@ -28,7 +28,6 @@ static std::string CUBES[NUM_CUBES] = "DEILRX", "DELRVY", "DISTTY", "EEGHNW", "EEINSU", "EHRTVW", "EIOSST", "ELRTTY", "HIMNQU", "HLNNRZ"}; -static const int NUM_ROLLED_CUBES = 4; std::array rollSides() { // Intermediate array to shuffle std::array cubes; @@ -44,11 +43,15 @@ std::array rollSides() { Boggle::Boggle() : m_showingSides(rollSides()), m_englishWords(Boggle::DICTIONARY_FILE) {} -bool Boggle::isWordValid(const std::string &word) const { +bool Boggle::isWordEnglish(const std::string &word) const { return m_englishWords.contains(word); } -bool Boggle::isWordPlayed(const string &word) const { +bool Boggle::isWordLongEnough(const std::string &word) const { + return word.length() >= MIN_WORD_LENGTH; +} + +bool Boggle::isWordPlayed(const std::string &word) const { return std::find(m_playedWords.begin(), m_playedWords.end(), word) != m_playedWords.end(); } diff --git a/src/Boggle.h b/src/Boggle.h index 36c98a8..cdab493 100755 --- a/src/Boggle.h +++ b/src/Boggle.h @@ -25,7 +25,8 @@ public: Boggle(); - bool isWordValid(const std::string &word) const; + bool isWordEnglish(const std::string &word) const; + bool isWordLongEnough(const std::string &word) const; bool isWordPlayed(const std::string &word) const; private: std::vector m_playedWords;