Fun Share: Wordle Solver in Thunkable!

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.

here’s the project link:
https://x.thunkable.com/copy/1e63a4b210e7c3f6c27117c1a724455c

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)

i hope it works for you! enjoy!

4 Likes

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.

Sample output
image

2 Likes

Awesome!! Very cool! Did you figuree out the logic yourself?

1 Like

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.

1 Like

That was kinda wild! I tried it on Wordle #2 in the Wordle Archive and it solved it in 4 guesses. I had no idea what it was doing the whole time. :sweat_smile:

image

3 Likes

I used the same expression and passed it to Web Viewer like this after having a list of all possible words.

and was able to get a result of 57 entries

3 Likes

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:

  1. keep all words that contain guess(1) (ie. 1st letter of guess) in any position.
  2. keep all words where guess(2) matches word(2)
  3. keep all words where guess(3 matches word(3)
  4. keep all words EXCEPT words that contain guess(4) anywhere
  5. keep all words EXCEPT words that contain guess(5) anywhere

the challenge is to create the regex on the fly, dynamically!
thanks!

2 Likes

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.

https://x.thunkable.com/projectPage/621c9b6c73ba2500119d10ef

So if you try to enter something like

  • new Date().toString() you will get todays date
  • "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.

1 Like

that’s an amazing tool! this is our exec_js block for thunkable!
thanks a lot.

3 Likes

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:

  1. if a word contains a “u” or “t”, delete it from the word list.
  2. if a word contains a “s” or “e”, keep it in the word list
  3. if a word contains an “a” in the 2nd position, keep the word
3 Likes

Amazing work @manyone

1 Like