Cheating at Wordscapes

Jackie was playing Wordscapes, the game that has seemingly addicted too many people. I was helping her out for a while, then I decided to, well, cheat.Cheat using an unlikely tool: Mathematica!The first command sets up the association with words of certain letters. The second line, the one with "neblit," is the cheat.Basically, the wordLookup association has all the words in the language (well, most) and I sort the letters alphabetically for each one. The second line takes the input and similarly sorts it, then takes all possible subsets of letters and checks if they are in the association wordLookup. If they are, it adds them to the result.The "SortBy," "Union," and "Flatten" are just to make the output look nicer.For those with Mathematica and an addiction, here's the code as text:

wordLookup = Merge[Association[{StringJoin[Sort[Characters[#]]] ->#}]&/@ Select[WordList[IncludeInflections->True],StringLength[#]<=8 && StringLength[#] >= 3&], Identity];SortBy[Union[Flatten[wordLookup[StringJoin[#]]&/@Select[Subsets[Sort[Characters["neblit"]], {3,8}],KeyExistsQ[wordLookup,StringJoin[#]]&]]], StringLength[#]&]
Previous
Previous

InSight Landed

Next
Next

Time to do things