summaryrefslogtreecommitdiffstats
path: root/labb5/src/Boggle.h
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2020-11-29 03:00:34 +0100
committerGustav Sörnäs <gustav@sornas.net>2020-11-29 03:00:34 +0100
commita6cd25a3865c69516861b027ef04ac2f83649544 (patch)
tree5fc2648ec1369581eaa439625f28b793f9a3a80e /labb5/src/Boggle.h
parent5216d920fb26638ceda9f6391c5449c5e7bc8409 (diff)
downloadtddd86-a6cd25a3865c69516861b027ef04ac2f83649544.tar.gz
two different search functions, some polish
Diffstat (limited to 'labb5/src/Boggle.h')
-rwxr-xr-xlabb5/src/Boggle.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/labb5/src/Boggle.h b/labb5/src/Boggle.h
index b6551ee..9e6e9cd 100755
--- a/labb5/src/Boggle.h
+++ b/labb5/src/Boggle.h
@@ -30,26 +30,35 @@ public:
void clear();
void shuffle();
- void find_all_words();
- string debug_words() const;
+ set<string> find_all_words() const;
+ bool find_single_word(const string& word) const;
string board_to_string() const;
string user_words_to_string(int words_per_line = 3) const;
+ string computer_words_to_string(int words_per_line = 3) const;
+
+ void do_computer_turn();
+ int get_computer_words_size() const;
+ int get_computer_score() const;
int get_user_words_size() const;
int get_user_score() const;
bool word_is_valid(const string& word) const;
bool word_is_unplayed(const string& word) const;
- bool add_user_word(const string& word);
+ void add_user_word(const string& word);
private:
- void find_words_helper(point cur_point, string cur_word, set<point> visited);
+ void find_all_words_helper(set<string>& words, point cur_point, string cur_word, set<point> visited) const;
+ bool find_single_word_helper(const string& word, point cur_point, string cur_word, set<point> visited) const;
+ string words_to_string(const set<string>& words, int words_per_line) const;
+
Lexicon dictionary;
Grid<char> board;
set<string> user_words;
- set<string> valid_words;
+ set<string> computer_words;
int user_score = 0;
+ int computer_score = 0;
};
#endif