i just wrote a wordle solver in thunkable! it seems to be able to solve a wordle game inside 6 moves. after you start it, it will present a next guess. enter this in wordle and wait for the feedback. encode this into the solver as letter codes (g=green, matched at exact location, y=yellow, found somewhere in the word, b=black or blank, not found in the target word). in the example below, the solver gave me SOCKO as the 2nd guess, and i entered back yggbb and press Evaluate to indicate how wordle responded. the solver is based on a 5700 word list and there is a possibility that a word might not be in wordle’s dictionary. in such a case, just press NF-Skip (not found).
it still has a lot of rough edges. if you’re stuck in a loop or cannot end the guessing, just press Restart to begin a new game.
below shows my thunkable version of wordle, side by side with the solver so you can see the relationship between the two. (i know - i could have made a video)
If we have access to JavaScript expressions then all you need is to pass the Green characters to the REGEX and replace the others with dots and the Yellow character with either brackets or vertical bars.
Example: with oc in correct positions and s available in the word you will have the expression as
(s|.)oc(s|.)(s|[^,])
Which should get you all words having oc as second and third characters and includes s anywhere in the word of 5 characters when searching through the list of possible words delimited by a comma.
If you are referring to the logic of the regex expression, I can easily build an app to short list possible answers in every step but the absence of the JavaScript block to directly execute JS expressions makes thing harder.
can you share your project AND your javascript? my solver works now using pure thunkable but i want to make another wordle solver version that uses regex to do the search-and-eliminate steps! the hard part is to convert say, yggbb to the correct regex that will do the following:
keep all words that contain guess(1) (ie. 1st letter of guess) in any position.
keep all words where guess(2) matches word(2)
keep all words where guess(3 matches word(3)
keep all words EXCEPT words that contain guess(4) anywhere
keep all words EXCEPT words that contain guess(5) anywhere
the challenge is to create the regex on the fly, dynamically!
thanks!
It is not a complete project but you are welcome to use it. Actually, I was developing a general JavaScript code executor so that you just enter your expression in the input field and the Web Viewer will execute the code and gives back the result.
"Welcome to Thunkable".length you will get number of characters in this sentence.
new Date(1645644034000).toString() will get 23rd Feb
That is the actual project, I’m just extending it to do the RegExp so you can enter something like
"Welcome to 100% coding".match(/\d{1,}/) you will get the digits only (100)
"Welcome to 100% coding".match(/co/g) you will get 2 of co
I have hardcoded in it that if you leave the input blank then it will use the text variable to search for a pattern example and give the result in a List Viewer.
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).
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: