state->position = prev_pos;
}
+#if !ALLOW_NON_WORD_AND_REPEAT_GUESSES
+static void display_not_in_dict(wordle_state_t *state) {
+ state->curr_screen = SCREEN_NO_DICT;
+ watch_display_string("nodict", 4);
+}
+
+static void display_already_guessed(wordle_state_t *state) {
+ state->curr_screen = SCREEN_ALREADY_GUESSED;
+ watch_display_string("GUESSD", 4);
+}
+
static uint32_t check_word_in_dict(uint8_t *word_elements) {
bool is_exact_match;
for (uint16_t i = 0; i < _num_words; i++) {
return _num_words + _num_possible_words;
}
+
+#endif
+
static bool check_word(wordle_state_t *state) {
// Exact
bool is_exact_match = true;
state->word_elements[i] = _num_valid_letters;
state->word_elements_result[i] = WORDLE_LETTER_WRONG;
}
+#if !ALLOW_NON_WORD_AND_REPEAT_GUESSES
for (size_t i = 0; i < WORDLE_MAX_ATTEMPTS; i++) {
state->guessed_words[i] = _num_words + _num_possible_words;
}
+#endif
state->using_random_guess = false;
state->attempt = 0;
}
}
#endif
-static void display_not_in_dict(wordle_state_t *state) {
- state->curr_screen = SCREEN_NO_DICT;
- watch_display_string("nodict", 4);
-}
-
-static void display_already_guessed(wordle_state_t *state) {
- state->curr_screen = SCREEN_ALREADY_GUESSED;
- watch_display_string("GUESSD", 4);
-}
-
static void display_lose(wordle_state_t *state, uint8_t subsecond) {
char buf[WORDLE_LENGTH + 6];
sprintf(buf," L %s", subsecond % 2 ? _valid_words[state->curr_answer] : " ");
}
static void get_result(wordle_state_t *state) {
+#if !ALLOW_NON_WORD_AND_REPEAT_GUESSES
// Check if it's in the dict
uint16_t in_dict = check_word_in_dict(state->word_elements);
if (in_dict == _num_words + _num_possible_words) {
}
state->guessed_words[state->attempt] = in_dict;
+#endif
bool exact_match = check_word(state);
if (exact_match) {
reset_all_elements(state);
#define WORDLE_LENGTH 5
#define WORDLE_MAX_ATTEMPTS 6
#define USE_DAILY_STREAK false
+#define ALLOW_NON_WORD_AND_REPEAT_GUESSES false // This allows non-words to be entered and repeat guesses to be made. It saves ~11.5KB of ROM.
/* USE_RANDOM_GUESS
* 0 = Don't allow quickly choosing a random quess
// Anything you need to keep track of, put it here!
uint8_t word_elements[WORDLE_LENGTH];
WordleLetterResult word_elements_result[WORDLE_LENGTH];
+#if !ALLOW_NON_WORD_AND_REPEAT_GUESSES
uint16_t guessed_words[WORDLE_MAX_ATTEMPTS];
+#endif
uint8_t attempt : 4;
uint8_t position : 3;
bool using_random_guess : 1;
// These are words that'll never be used, but still need to be in the dictionary for guesses.
// Number of words found: 1898
static const char _possible_words[][WORDLE_LENGTH + 1] = {
+#if !ALLOW_NON_WORD_AND_REPEAT_GUESSES
"AALII", "AARTI", "ACAIS", "ACARI", "ACCAS", "ACERS", "ACETA", "ACHAR", "ACHES",
"ACHOO", "ACINI", "ACNES", "ACRES", "ACROS", "ACTIN", "ACTON", "AECIA", "AEONS",
"AERIE", "AEROS", "AESIR", "AHEAP", "AHENT", "AHINT", "AINEE", "AIOLI", "AIRER",
"TRATT", "TREEN", "TREES", "TRESS", "TREST", "TRETS", "TRIAC", "TRIER", "TRIES",
"TRILL", "TRINE", "TRINS", "TRIOL", "TRIOR", "TRIOS", "TRIPS", "TRIST", "TROAT",
"TROIS", "TRONA", "TRONC", "TRONE", "TRONS", "TROTH", "TROTS", "TSARS",
+#endif
};
#if (USE_RANDOM_GUESS == 2)
'''\r
Prints the array of valid words that the wordle_face.c can use\r
'''\r
+ print("#ifndef WORDLE_FACE_DICT_H_")\r
+ print("#define WORDLE_FACE_DICT_H_")\r
+\r
+ print("\n#ifndef WORDLE_LENGTH")\r
+ print("#define WORDLE_LENGTH 5")\r
+ print("#endif")\r
+\r
+ print("\n#ifndef USE_RANDOM_GUESS")\r
+ print("#define USE_RANDOM_GUESS 2")\r
+ print("#endif\n")\r
+ \r
items_per_row = 9\r
valid_words = list_of_valid_words(letters, valid_list)\r
valid_words = capitalize_all_and_remove_duplicates(valid_words)\r
print("\n// These are words that'll never be used, but still need to be in the dictionary for guesses.")\r
print(f"// Number of words found: {len(possible_words)}")\r
print("static const char _possible_words[][WORDLE_LENGTH + 1] = {")\r
+ print("#if !ALLOW_NON_WORD_AND_REPEAT_GUESSES")\r
i = 0\r
while i < len(possible_words):\r
print(" ", end='')\r
print(f'"{clean_chars(possible_words[i])}", ', end='')\r
i+=1\r
print('')\r
- print("};")\r
- print('')\r
+ print("#endif")\r
+ print("};\n")\r
\r
- print(f"\nstatic const uint16_t _num_unique_words = {num_uniq}; // The _valid_words array begins with this many words where each letter is different.")\r
+ print("#if (USE_RANDOM_GUESS == 2)")\r
+ print(f"static const uint16_t _num_random_guess_words = {num_uniq}; // The _valid_words array begins with this many words where each letter is different.")\r
+ print("#elif (USE_RANDOM_GUESS == 1)")\r
+ print("static const uint16_t _num_random_guess_words = _num_words;")\r
+ print("#endif")\r
+ print("\n#endif // WORDLE_FACE_DICT_H_")\r
\r
\r
def get_sec_val_and_units(seconds):\r