Speed up a slow loop

J. Landman Gay jacque at hyperactivesw.com
Mon Mar 7 17:22:08 EST 2022

On 3/7/22 12:30 PM, Alex Tweedly via use-livecode wrote:
> The boardwalk will find all valid words on the board. So that list of words can be used as the 
> "dictionary" for the user's guesses - and now you have a "dictionary" of only a few hundred 
> words, rather than than the many thousands of either the original or the filtered dictionaries.
> And it's worth saying that the fast boardwalk only explores those potential words that are on 
> the board, so there's no need to filter the dictionary for it.
> The caveat - a user guess which isn't in the word list found by the boardwalk can be either 
> "not a word" or "a word, but not present on the board", and you don't know which. If your UI 
> needs to distinguish between those cases, you'd need to do another step of checking these 
> (hopefully very few) failure cases against the full dictionary.

Wow, that's something else that didn't occur to me. I do, of course, have the word list from 
your board walk. At present I use it to provide a hint on demand if the user gets stuck. It's 
cheating, but hey, this is a one-person game and you're only cheating yourself. Nobody says you 
have to click that button.

I do need to discriminate between non-words and words not on the board, but the dictionary 
check is now so fast that it isn't a problem. The most time-consuming part is now the 
boardwalk, but it will be instant when I check the word list your script creates.

Have you heard the joke about how a camel is a horse created by a committee? That's not always 
true. This game is getting better and better.

Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

More information about the use-livecode mailing list