Message Boards Message Boards

A Wolfram Language facsimile of Wordle

Attachments:
POSTED BY: David Reiss
31 Replies
POSTED BY: David Reiss
POSTED BY: David Reiss

Another interesting Wordle implementation in Mathematica:

n-Wordle

It's a world of Wordles!

POSTED BY: David Reiss

And for something else…

Worldle, not Wordle

POSTED BY: David Reiss

I wrote a small blog post on this which you can read here:

Wordle the Wolfram Way

POSTED BY: David Reiss

It seems that Wordle was just sold to the New York Times:

New York Times press release

POSTED BY: David Reiss

An interesting statistics that just went viral on Reddit:

enter image description here

POSTED BY: Vitaliy Kaurov

Using this, someone should really train an agent to play Wordle at a high level.

POSTED BY: Peter Barendse

Sure (though I prefer to keep a sense of mystery each time I do the real Wordle). Arnoud has written an blog post with some additional analysis using the ResourceFunction that contains the actual Wordle words that he scraped. Here is the link to that (posted with his permission):

Tips and Tricks for Solving Wordle Efficiently

The takeaway is, of course, that you can easily analyze strategies with the Wolfram Language and, of course, have fun doing it!

POSTED BY: David Reiss

It seems that both things are true?

In[]:= Complement[wordleWords, my5LetterWords][[-10 ;;]]

Out[]= {"zulus", "zupan", "zupas", "zuppa", "zurfs", "zuzim", \
"zygal", "zygon", "zymes", "zymic"}

And, for example, "zygal" is a word):

zygal definition on Dictionary.com

"Having a shape like a yoke or like the letter H"

When it comes to "zulus", for example,

In[]:= DictionaryWordQ["Zulu"]

Out[]= True

It seems that the plural is not in the way that I retrieved the 5 letter words and that I'd need to be more careful in making sure that the various plurals are in my list (and making sure that I take care of capitalization as I do it):

In[]:= Pluralize["Zulu"]

Out[]= "Zulus"

So, I am the student that this exercise is intended for!

POSTED BY: David Reiss

Fair enough... thanks!

POSTED BY: Arnoud Buzing

I updated the code to catch plurals like "Zulus". I still find that the WordList "KnownWords" dictionary does not contain, for example, some words that are conjugations of verbs. Perhaps I am not quite understanding what the restrictions on WordList["KnownWords"] is.

In[]:= MemberQ[WordList["KnownWords"], "ate"]
Out[]= False

In[]:= MemberQ[WordList["KnownWords"], "walked"]    
Out[]= False

And I find this strange when, for example,

In[]:= WordData["ate", "PartsOfSpeech"]    
Out[]= {"Verb"}

And

In[]:= DictionaryWordQ["ate"]    
Out[]= True

BTW, I came across this issue when I was checking today's (1/30) online word for Wordle (slight spoiler in that).

POSTED BY: David Reiss

I found Wordle's word list online and put it in a ResourceObject:

ResourceData[
 ResourceObject[
  CloudObject[
   "https://www.wolframcloud.com/obj/arnoudb/DeployedResources/Data/Wordle-Word-List"]]]

More information here:

https://www.wolframcloud.com/obj/arnoudb/DeployedResources/Data/Wordle-Word-List

POSTED BY: Arnoud Buzing

Thanks Arnoud!

POSTED BY: David Reiss

So this raises an interesting question about the words contained in Mathematica's WordList.

Here are the 5 letter words that I have used from WordList["KnownWords", IncludeInflections -> True]:

my5LetterWords =
  Module[{words},
    words = 
    Select[WordList["KnownWords", IncludeInflections -> True], 
     StringLength[#] === 5 &];
   words = Select[words, StringMatchQ[#, LetterCharacter .. ] &];
   Union[words]
   ];

And here are the words that Arnoud put in the ResourceObject:

wordleWords = 
  ResourceData[
   ResourceObject[
    CloudObject[
     "https://www.wolframcloud.com/obj/arnoudb/DeployedResources/Data/\
Wordle-Word-List"]]];

There are quite a few more in wordleWords than in my5LetterWords:

In[]:= Length /@ {my5LetterWords, wordleWords}

Out[]= {7766, 12972}

Here are how many more are in the wordle words:

In[]:= Length[Complement[wordleWords, my5LetterWords]]

Out[]= 6854

And there are some missing in the other direction:

In[]:= Length[Complement[my5LetterWords, wordleWords]]

Out[]= 1648

So, exercise for the interested student: what is going on here, and is Mathematica's dictionary a bit too sparse?

POSTED BY: David Reiss

There's nothing wrong with the WL dictionaries, the Wordle word list seems to include a lot of "non-words". Not sure why, but the Wordle game does accept those "non-words" on that list (I checked a few).

I've added a few more "solving tricks" here: https://arnoudbuzing.medium.com/tips-and-tricks-for-solving-wordle-efficiently-28ab67a52dbf

POSTED BY: Arnoud Buzing

It's amazing how many words I don't know. I think some human it picking the secret words, though. Given the list of them so far, it seems to be a different dictionary than the accepted words (maybe the average of their use-frequency is statistically higher than that of other dictionaries?)

POSTED BY: Peter Barendse

Congratulations! Your post was highlighted on the Wolfram's official social media channels. Thank you for your contribution. We are looking forward to your future posts.

POSTED BY: Moderation Team

There is a lot of chatter on the internet about this question (as we would expect!). Just Google "best words for Wordle" and feast your eyes. Though I prefer to leave an air of mystery to my use of the game, I can't help but take a crack at this over my morning coffee. Here's one approach:

POSTED BY: David Reiss

Nice! It's great to see how compact this is!

POSTED BY: Danny Finn

I was thinking it would be good to compute what the best starting word would be for wordle based on WordData, letter frequencies and letter position frequencies. The final word has to be a real 5-letter word as a constraint. So far I haven't tried out any analysis though. Usually I use AUDIO or TEARS although it would be nice to have a top ten best words to pick from.

POSTED BY: Danny Finn

I think about characters rather than words, since I am looking for the most used characters

So for example if I am looking for 4-letters word, I use NEAT or something similar, but your logic is interesting and I want to try coding it.

POSTED BY: Ahmed Elbanna

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: Moderation Team
Posted 2 years ago

Wordle post on MSE.

POSTED BY: Rohit Namjoshi

Thanks! I put a link to this post as a reply on that stackexchange post. Update: I did not see that you had added a link to here as a comment, but I will leave mine up as well and let the moderators choose whether to delete it. Thanks again!

POSTED BY: David Reiss

Hi David,

thanks for sharing this interesting code!

It is fun to note that [...] the web version of Wordle it is about 2000 lines of code. The facsimile in Mathematica [...] is a bit more than 350 lines of code.

Exactly - the Mathematica version of code appears virtually always to be shortest. This can also be seen in an impressive way at rosettacode.org, where an incredible lot of programming languages are compared.

POSTED BY: Henrik Schachner

Thanks! It was fun to create on a slow Sunday evening.

POSTED BY: David Reiss

It is fun to note that, if you look at the javascript code for the web version of Wordle it is about 2000 lines of code. The facsimile in Mathematica (which admittedly does not have quite the same functionality as the original) is a bit more than 350 lines of code.

POSTED BY: David Reiss

For those who want to cheat, I have added a cheating button that gives you the answer if you have enabled it with the checkbox next to it. But, don't cheat! ;-)

  • I have updated the notebook and changed the name of the application from Wordle to MWordle. And I have added some usage messages to the functions and parameter in the notebook. Also I have added one more row to the set of possible guesses that you can make so it has the same array size as in the original web version of the game.

  • Added a small update with a menu to let the user choose the part of speech to use in the puzzle: all words, nouns, verbs, or adjectives.

  • I added a but more to my original post with instructions on how to set things up so that you can launch the MWordle game from a custom notebook via a simple button.

  • I have updated the MWordle.nb notebook attached to this post with some additional commentary within it. The full notebook is also posted inline in the top level post. However, download the attached notebook to play with the code directly.

  • I updated the main post with a screenshot of the game. Enjoy!

POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract