Long enough
This commit is contained in:
parent
b5fbdd5ab5
commit
f3871a09e7
@ -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<std::string, NUM_ROLLED_CUBES> rollSides() {
|
||||
// Intermediate array to shuffle
|
||||
std::array<std::string, NUM_CUBES> cubes;
|
||||
@ -44,11 +43,15 @@ std::array<std::string, NUM_ROLLED_CUBES> 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();
|
||||
}
|
||||
|
@ -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<std::string> m_playedWords;
|
||||
|
Loading…
x
Reference in New Issue
Block a user