literant-search
v1.1.1
Published
Efficient searches for high scoring words on a Scrabble-like board using either a Trie or compressed DAWG.
Downloads
12
Readme
Call aiInit once on startup passing a word list as an array. Word list words must be in upper case. The compress option will turn the lookup Trie into a compressed directed acyclic word graph.
This uses less RAM, but does come with a precalc cost and doesn't affect the search speed.
aiInit(wordList, options={compress: true, debug: 0})
During an AI turn call aiFindMove to search the board for the highest scoring move. The parameter board is a one dimensional array of characters.
Empty slots are represented by spaces, capitalized letters denote placed letters and lower case letters symbolize blank tiles placed.
The second argument, letters, is an upper-case string containing letters in the AI player's rack. For blank letters, use underscores.
aiFindMove(board, letters)
Return value is an object with the following attributes:
