Skip to content

Improve word suggestion algorithm

Description

This MR adds find_possible_words (clue, grid, word_list). This function returns an array of possible words for a given clue. The word suggestion list now uses this function to get a list of possible words, instead of the word_list_find_intersection.

Design doc.

Overview of changes

  • word-suggestion.c
    • Added find_possible_words ().
  • word-suggestion-tests.c
    • Added basic tests for find_possible_words ().
    • Added IPUZ files for the tests, in src/tests/word-suggestion.
  • edit-word-list.c
    • We don't need to keep track of the filter strings and offsets anymore, because find_possible_words doesn't need those. So I removed all the code related to those.
    • We do need to keep track of the current clue and direction, because find_possible_words needs those. So I added code for that.
    • I moved calculate_clue_word_pos into word-list-misc. edit-word-list.c doesn't use that function anymore, but word-suggestion.c does.
  • word-list-misc.c
    • Added WordSet, a typedef of GHashTable.
    • Added functions for WordSet.

Merge request reports

Loading