#include "dict.h"
+/* Remember that dict reserves the 0th bit for IS_WORD */
+#define GRID_WORD_SEEN (1<<1)
+
char *cube_faces[16] = {
"aaeeng", "abbjoo", "achops", "affkps",
"aoottw", "cimotu", "deilrx", "delrvy",
string_chop (word);
}
-void
+static void
board_solve (board_t *board, dict_t *dict, dict_t *solution)
{
int x, y;
string_fini (&word);
}
+static bool_t
+seen_predicate (dict_entry_t entry)
+{
+ return entry & GRID_WORD_SEEN;
+}
+
+static bool_t
+unseen_predicate (dict_entry_t entry)
+{
+ return ! seen_predicate (entry);
+}
+
#define GAME_LENGTH (3 * 60)
int
main (void)
dict_entry_t *entry;
entry = dict_lookup (&solution, response);
if (DICT_ENTRY_IS_WORD (entry)) {
- if (*entry & TRIE_FLAGS_SEEN)
+ if (*entry & GRID_WORD_SEEN)
printf ("(repeat)\n");
else
- *entry |= TRIE_FLAGS_SEEN;
+ *entry |= GRID_WORD_SEEN;
} else {
entry = dict_lookup (&dict, response);
if (DICT_ENTRY_IS_WORD (entry))
} while (remaining > 0);
printf ("\nWords you found:\n");
- string_init (&word);
- found = trie_print_seen (&solution, &word);
- string_fini (&word);
- printf ("\n");
+ found = dict_print_by_length_if (&solution, seen_predicate);
printf ("\nWords you missed:\n");
- string_init (&word);
- missed = trie_print_unseen (&solution, &word);
- string_fini (&word);
+ missed = dict_print_by_length_if (&solution, unseen_predicate);
printf ("\n");
- printf ("\nYou found %d of %d words (%.2f%%)\n",
+ printf ("You found %d of %d words (%.2f%%)\n",
found, found + missed,
100 * (double) found / (found + missed));