Skip to content

ljdoig/LetterBoxedSolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Approach

Using a Trie and adjacency lists for subsequent letters, pick a starting letter then check the Trie to see if any of its subsequent letters are sub-Tries. Do this recursivley with the sub-Tries. If you get to a sub-Trie which represents the end of a word, begin a new word but continue traversing for longer words also. We cut the search at a max solution length of 3 words by default, as usually some solution exists with this length. See implementation here.

Run it

I've included a MacOS executable which you can run with:

$ ./letter_boxed.exe "dko rjt snb auy"

which will print all 7759 solutions of max length 3. Or you can filter to shorter solutions:

$ ./letter_boxed.exe "dko rjt snb auy" -max 2
Loaded dictionary and filtered to relevant words (2006 words)
Found 2 solution(s) of max length 2:
junks storyboards
junks storyboard

Best solution out of 2:
junks storyboard

You can also pass your own word list if the ENABLE wordlist is not to your liking:

$ ./letter_boxed.exe "dko rjt snb auy" -max 2 -filename corpuses/scrabble.txt
Loaded dictionary and filtered to relevant words (3232 words)Found 13 solution(s) of max length 2:
adjutants skyboards
adjutants skyboard
junks storyboards
jurants skyboards
adjustors skyborn
adjutants skyborn
juntas skyboards
juntos skyboards
junks storyboard
jurants skyboard
juntas skyboard
juntos skyboard
adjusts skyborn

Best solution out of 13:
adjusts skyborn

About

Sovler for the NYT puzzle Letter-Boxed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages