View Source Backfish.Examples.WordSearch (Backfish v0.1.0)

An implementation of the word search puzzle using the Backfish backtracking library.

The word search puzzle involves finding a list of words in a grid of letters. Words can be placed horizontally, vertically, or diagonally, and can be read forwards or backwards.

Summary

Functions

Returns the initial state of the word search puzzle.

Checks if the given state is a goal state.

Generates the next possible states from the given state.

Functions

Returns the initial state of the word search puzzle.

Parameters

  • args: A keyword list of arguments. Expects :board, which is a 2D list representing the letter grid, and :words, which is a list of words to find in the grid.

Returns

  • A map representing the initial state, including the board, the list of words, the found words, and the paths taken to find the words.

Checks if the given state is a goal state.

Parameters

  • state: The current state of the problem, which includes the list of words and the found words.

Returns

  • true if all words have been found, false otherwise.

Generates the next possible states from the given state.

Parameters

  • state: The current state of the problem, which includes the board, the list of words, the found words, and the paths taken to find the words.

Returns

  • A list of the next possible states, each including the updated board, the list of words, the updated list of found words, and the updated paths.