summaryrefslogtreecommitdiff
path: root/Userland/Games/MasterWord/WordGame.h
diff options
context:
space:
mode:
authorPaweł Łukasik <lukasik.pawel@gmail.com>2022-05-21 09:57:46 +0200
committerLinus Groh <mail@linusgroh.de>2022-05-26 21:44:58 +0100
commit01c7158ffe4719dc1cf74c25675e6c7d73e9e2ec (patch)
treeb6cfa871ecd94c5f3ba81c5090cf9304d3c5d482 /Userland/Games/MasterWord/WordGame.h
parent1297f81ddfee6fc7d55e64c77fa167ac5425b4b2 (diff)
downloadserenity-01c7158ffe4719dc1cf74c25675e6c7d73e9e2ec.zip
MasterWord: Check guesses against the word list
Previously guesses were not checked which allowed guesses like 'aaaaa' to be entered. Currently there's an option to set if a guess should be checked against the dictionary and rejected if it doesn't exist there. Additionally settings from Game menu have been moved to its own entry - Settings.
Diffstat (limited to 'Userland/Games/MasterWord/WordGame.h')
-rw-r--r--Userland/Games/MasterWord/WordGame.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Games/MasterWord/WordGame.h b/Userland/Games/MasterWord/WordGame.h
index 1c62605fd3..02cf32e4b9 100644
--- a/Userland/Games/MasterWord/WordGame.h
+++ b/Userland/Games/MasterWord/WordGame.h
@@ -19,6 +19,7 @@ public:
void reset();
void set_use_system_theme(bool b);
+ void set_check_guesses_in_dictionary(bool b);
void set_word_length(size_t length);
void set_max_guesses(size_t max_guesses);
Gfx::IntSize game_size() const;
@@ -26,8 +27,10 @@ public:
Optional<String> random_word(size_t length);
size_t shortest_word();
size_t longest_word();
+ bool is_checking_guesses() const;
void add_guess(AK::StringView guess);
+ bool is_in_dictionary(AK::StringView guess);
private:
WordGame();
@@ -42,6 +45,8 @@ private:
size_t m_max_guesses { 6 };
size_t m_num_letters { 5 };
+ bool m_check_guesses { false };
+ bool m_last_word_not_in_dictionary { false };
static constexpr int m_letter_width { 40 };
static constexpr int m_letter_spacing { 5 };
static constexpr int m_outer_margin { 20 };
@@ -53,6 +58,7 @@ private:
Color m_wrong_letter_color { m_border_color };
Color m_background_color { Color::from_rgb(0x121213) };
Color m_text_color { Color::White };
+ Color m_word_not_in_dict_color { Color::from_argb(0x40aa0000) };
enum LetterState {
Correct,