summaryrefslogtreecommitdiffstats
path: root/labb5/src/Boggle.h
diff options
context:
space:
mode:
Diffstat (limited to 'labb5/src/Boggle.h')
-rwxr-xr-xlabb5/src/Boggle.h36
1 files changed, 31 insertions, 5 deletions
diff --git a/labb5/src/Boggle.h b/labb5/src/Boggle.h
index 3abe9b5..b6551ee 100755
--- a/labb5/src/Boggle.h
+++ b/labb5/src/Boggle.h
@@ -9,21 +9,47 @@
#include <iostream>
#include <string>
-// TODO: include any other header files you need
+#include <set>
+#include "lexicon.h"
+#include "grid.h"
+#include <utility>
using namespace std;
+using point = pair<int, int>;
class Boggle {
public:
const string DICTIONARY_FILE = "EnglishWords.dat";
const int MIN_WORD_LENGTH = 4;
- const int BOARD_SIZE = 4;
+ static const int BOARD_SIZE = 4;
- // TODO: decide the public member functions and declare them
+ Boggle();
+ bool letters_from_string(const string& letters);
-private:
- // TODO: decide the private member variables/functions and declare them
+ void read_dictionary();
+ void clear();
+ void shuffle();
+
+ void find_all_words();
+ string debug_words() const;
+
+ string board_to_string() const;
+ string user_words_to_string(int words_per_line = 3) 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);
+
+private:
+ void find_words_helper(point cur_point, string cur_word, set<point> visited);
+ Lexicon dictionary;
+ Grid<char> board;
+ set<string> user_words;
+ set<string> valid_words;
+ int user_score = 0;
};
#endif