// ____ _ _ // | __ ) ___ __ _ __ _| | ___ | |__ // | _ \ / _ \ / _` |/ _` | |/ _ \ | '_ \ // | |_) | (_) | (_| | (_| | | __/_| | | | // |____/ \___/ \__, |\__, |_|\___(_)_| |_| // |___/ |___/ // Author: Love Billenius #ifndef _boggle_h #define _boggle_h #include "lexicon.h" #include #include #include static const int g_NUM_ROLLED_CUBES = 4; class Boggle { public: static const std::string s_DICTIONARY_FILE; static const int s_MIN_WORD_LENGTH = 4; static const int s_BOARD_SIZE = 4; public: Boggle(); /** * Getter for the users played words */ const std::vector &playedWords() const; const std::array showingSides() const; bool isWordEnglish(const std::string &word) const; bool isWordLongEnough(const std::string &word) const; bool isWordPlayed(const std::string &word) const; static unsigned int getPointsForWord(const std::string &word); /** * @brief userInsert saves the users word * @return false if the word is already inserted */ bool userInsert(std::string word); /** * @brief computerPlay calculates all possible english words which can be * formed from the Lexicon recursivly * @return all possible words of the current board */ std::vector computerPlay() const; private: void backtrack(std::vector &validWords, std::unordered_set &visited, std::string &word) const; private: // This is kept as a vector since there's max 16 words std::vector m_playedWords; std::array m_showingSides; Lexicon m_englishWords; }; #endif