Page 2 of 2

Re: Filtering question

Posted: Thu Jan 20, 2022 8:54 am
by SWEdeAndy
bn wrote: Wed Jan 19, 2022 8:52 pm Thank you very much again for this beautiful piece of code.
I join in the praising - that was an awesome solution, Dick!
I'll remember that method for future cases.

I think a Wordle solver would be a great case study as a LiveCode project.
The above is already a start, and then increasingly complex "singling out" algorithms can be implemented, based on correct or semi-correct letters etc.

Re: Filtering question

Posted: Fri Jan 21, 2022 7:41 am
by rkriesel
SWEdeAndy wrote: Thu Jan 20, 2022 8:54 am I join in the praising - that was an awesome solution, Dick!
I'll remember that method for future cases.

I think a Wordle solver would be a great case study as a LiveCode project.
The above is already a start, and then increasingly complex "singling out" algorithms can be implemented, based on correct or semi-correct letters etc.
Thanks, SWEdeAndy. Since I'm honored by the praise, I must be sure to thank LC for the filter command, and for the dictionary entry that made this solution possible.
Can you specify the Wordle algorithms?

Re: Filtering question

Posted: Fri Jan 21, 2022 7:57 am
by Jellicle
rkriesel wrote: Wed Jan 19, 2022 8:07 am Hi, Jellicle. Here's a technique that runs over twenty times as fast as the nested-repeat technique (as coded by SWEdeAndy):

Code: Select all

function filterWordsWithChars pWords, pChars
   repeat for each char tChar in pChars
      filter pWords with "*" & tChar & "*"
   end repeat
   return pWords
end filterWordsWithChars
This is fantastic! Many thanks!

g

Re: Filtering question

Posted: Fri Jan 21, 2022 6:48 pm
by bobcole
Here is a stack that uses two filtering techniques on lists of Wordle words.

To scan Wordle's Guess Words these techniques use LC's built-in features (see the Dictionary):
The first technique uses LC's matchText function; and
The second technique uses LC's filter command.

FYI:
The word lists come from this web article (see the Riddler Classic section):
https://fivethirtyeight.com/features/wh ... et-wordle/
Wordle's 12,972 "Guess" words are acceptable to enter as an attempted solution; and
Wordle's 2,315 Magic words are the only possible answers.

Please feel free to adapt or use this stack in any manner. I claim no credit for this stack.
Enjoy,
Bob

Wordle Tools.livecode.zip
(49.9 KiB) Downloaded 496 times

Re: Filtering question

Posted: Sat Jan 22, 2022 3:30 am
by rkriesel
Jellicle wrote: Fri Jan 21, 2022 7:57 am This is fantastic! Many thanks!
You're welcome, Jellicle. Thanks for the opportunity.
-- Dick