From a6cd25a3865c69516861b027ef04ac2f83649544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Sun, 29 Nov 2020 03:00:34 +0100 Subject: two different search functions, some polish --- labb5/src/Boggle.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'labb5/src/Boggle.h') 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 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 visited); + void find_all_words_helper(set& words, point cur_point, string cur_word, set visited) const; + bool find_single_word_helper(const string& word, point cur_point, string cur_word, set visited) const; + string words_to_string(const set& words, int words_per_line) const; + Lexicon dictionary; Grid board; set user_words; - set valid_words; + set computer_words; int user_score = 0; + int computer_score = 0; }; #endif -- cgit v1.2.1