wordle solver in GP

Post your nifty GP projects here!

Moderator: MSandro

Post Reply
manyone
Posts: 41
Joined: Nov 5th, '17, 07:56

wordle solver in GP

Post by manyone » Mar 7th, '22, 04:27

it was only a matter of time...

here's a screen shot showing the interaction between wordle solver and wordle player.
gpsolver.jpg
you start both apps but the solver makes the first move and proposes a first guess (in this example, "quail"). enter this word into the player and wait for its response. translate the response using these codes and enter back in solver:

g -the letter at that position exactly matches the letter in the target word in the same position.
y -the letter at that position is found somewhere in the target word but at a different position.
b -the letter at that position is not found in the target word.

note how the response to "quail" was translated as "bybbb". you get the idea.

after you've played wordle for a while, you begin to acquire "common sense" rules when formulating new guesses after the first guess. for example, any letter marked black (or blank) in a prior guess is sure to be avoided in building your next guess word. any letter marked green is sure to be included in your next guess and kept at it's last position. while any letter marked yellow needs to be included in the word, anywhere in the word.

all i did was translate there rules into code that applied stepwise elimination of words after each step. the word list intially starts at 5700+ but the next word guess, after the word elimination rules are applied - is whittled down to say 500 and additional guesses and rules reduce the count even more until hopefully, there is only one word left - by process of elimination. the solver seems to be able to guess most games inside 6 moves!

that is the perfect scenario of course. you may end up with a handful choices in the end because the solver's random choice for the next word does not happen to match the target word. there are also cases when the solver proposes a guess that is not found in the player's dictionary. in those cases, please press "x" to skip the current proposed guess and allow solver to make a new guess. finally, type "0" when you want to start a new game.

here's the program:
wordle_solver.gpp
(78.02 KiB) Downloaded 1113 times

Post Reply