i followed the method suggested by @muneer and created a version of wordle solver that uses regular expressions for arriving at the solution. I used the “exec_js” block created by @muneer and it worked like a charm.
here’s the project link:
https://x.thunkable.com/copy/b49c641ecc5429276e93b76bb58a21cf
in order to call the webviewer rouitine, you pass the word list and the regular expression you wish to apply to it. So, i must warn you that the first call to the webviewer routine sends the full word list (5700+ words) everytime! the next succeeding calls reduce that number more and more until we find a solution or run out of guesses (which could happen).
i ran the solver against the wordle version of @tony.ycy.program and it found the target in 4 moves. (your mileage may vary).
here are the last 2 steps of the whole process:
if you don’t know about it yet, you should read up on regular expressions and how they are used.
for example, if the solver proposes a word, say "saute"and you type back a color response of “ygbby”, this is the regular expression my solver generates:
(?![a-z]*[ut])(?=[a-z]*s)(?=[a-z]*e)(s|[^,])a(s|[^,])(s|[^,])(s|[^,])
that expression is an extremely compact way of saying the following statements:
- if a word contains a “u” or “t”, delete it from the word list.
- if a word contains a “s” or “e”, keep it in the word list
- if a word contains an “a” in the 2nd position, keep the word