|Pathologically Eclectic Rubbish Lister|
Improve My FaceBook Scramble Solverby Limbic~Region (Chancellor)
|on Aug 17, 2009 at 22:33 UTC||Need Help??|
Limbic~Region has asked for the
wisdom of the Perl Monks concerning the following question:
There is a FaceBook app which is really just a Flash game. It is called Scramble and I will do my best to recap the rules. You are presented with a 4x4 or a 5x5 grid of randomly selected letters. You must find as many words inside the grid in 3 minutes as possible. Points are scored based on the number of letters in the word and no points are awarded for words with less than 3 letters. The words are formed by chaining adjacent letters together i.e the next letter must be adjacent to the current. A position in the grid may only be used once in the word chain but after entering the word, the entire grid can be used for the next chain. There is no penalty for words entered not in the game's dictionary.
After scouring the net for word lists, I generated the following two scripts:
These 30 lines of code produce impressive results. It does run into a few issues:
After the game has ended, a complete list of solutions according to Scramble is provided. If that could be extracted, the first two issues could go away by pruning and augmenting the word list to match over time. Unfortunately, being Flash - I have no idea how to do this. The 3rd issue is a matter of the time delay of the SendKeys function. I can slow it down but then issue 4 is exacerbated (running out of time).
Does anyone have any thoughts on how this can be improved. I think the biggest win would be figuring out how to get the "correct" list out of the Flash application after the game is over but there is likely an obvious solution I am just missing. Your thoughts?
Update: Just clicked on a word to get its definition and saw that they are using the Tournament Word List (TWL) Scrabble dictionary. Hopefully that will alleviate the issues I have been having but I still very much would like your feedback.
Update 2: In a private /msg, a monk mentioned I might want to point out that adjacent means any touching square to include diagonally.
Cheers - L~R