Function Repository Resource:

PlayWordle

Source Notebook

Play the popular online word game Wordle

Contributed by: Christopher Stover

ResourceFunction["PlayWordle"][]

deploys a version of the popular online word game Wordle inside a Manipulate object.

Details

ResourceFunction["PlayWordle"] is based on the popular online word game Wordle.
ResourceFunction["PlayWordle"] uses a default word list of length 2800 that combines the official Wordle wordlist with a list suggested by a Wolfram Function Repository reviewer. This is not directly related to the resource data object Wordle Word List.
In each game, the user has six guesses to discover the correct word. After each guess, the color of the tiles shows how close your guess was to the correct word. For example:
The letter "i" is in the word and in the correct spot:
The letter "e" is in the word but in the wrong spot:
The letter "u" is not in the word in any spot:
Guesses must be five-letter words and must consist of words in either the default word list described above or the resource data object Wordle Word List (with a Union happening in the backend). Guesses which violate either of these parameters will generate a MessageDialog object.
Guesses may contain any combination of uppercase and lowercase (English) letters and are automatically converted to lowercase using ToLowerCase before ResourceFunction["PlayWordle"] does its analysis.
In some situations (as described in "Scope" below), the correct word is defined at game's end. This is done internally using WordDefinition.

Examples

Basic Examples (6) 

Launch the PlayWordle interface:

In[1]:=
ResourceFunction["PlayWordle"][]
Out[1]=

To play the game, type your guess into the InputField and either click the Submit Guess button or press the key on your keyboard:

Doing so gives immediate feedback on your guess:

The goal is to use this feedback to guide subsequent guesses. Subsequent guesses are made by typing new words into the InputField and clicking the Submit Guess button (and/or pressing the key on your keyboard):

Keep guessing until you reach an end result. Some games do not go your way: This happens when you use up all your guesses and fail to find the correct word. When this happens, the correct word is given in Red:

Other games may go better and you may find the correct word within the allotted number of attempts. When this happens, the correct word is given in Darker[Green]:

Scope (4) 

Similarly to the online version, the deployed keyboard within PlayWordle keeps track of your progress in the game:


During a game, you can click the Reset button to clear everything and start over:


If the correct word has definitions available via WordDefinition, they may be viewed by clicking the ? button at the end of a game:

This is also true for unsuccessful games as well:


Guesses may contain any combination of uppercase and lowercase (English) letters; capitalization is automatically stripped in the backend using ToLowerCase:

Possible Issues (2) 

Valid PlayWordle guesses must consist of exactly five letters. Guesses with more or fewer letters will generate a MessageDialog:


Valid PlayWordle guesses must also consist of words appearing in either the default word list or the resource data object Wordle Word List. Guesses which do not appear therein will generate a MessageDialog:

Publisher

therealcstover

Version History

  • 1.1.0 – 14 March 2022
  • 1.0.0 – 22 February 2022

Related Resources

Author Notes

v 1.1.0

The InputField was wrapped in an EventHandler so that guesses can be submitted using the key.
This one's for you, Bob!
Scrolling behavior (via Pane and options) has been (conditionally) added to the "Definitions" MessageDialog in the event that words have a large number of definitions (e.g. "clear").
A modified wordlist was implemented. This contains pieces of the v1.0.0 wordlist combined with some of the words in the official Wordle list.
Special care was implemented so that contractions are excluded and obscenities are largely removed.
Support was added for guesses containing uppercase letters. The "Scope" subsection was updated accordingly.
The D&O section was modified, and some of the verbiage in "Possible Issues" was updated.

v 1.0.0

Online sources suggest that the official Wordle game has a list of words it uses for the game (link) and a separate word list consisting of what it considers "valid guesses" (link).
This source says that the daily puzzle words will never be pulled from the "valid guesses" list, but I have not taken the time to investigate the Wordle source code extensively enough to see whether this is true. Future versions may consist of tweaks along these lines.
To the best of my knowledge, the resource data object Wordle Word List is a combination of all possible Wordle-related words (i.e. a Union of the two above-mentioned word lists).
There are plans for future versions to implement:
allowing users to choose from different word lists (the Wordle one, WordList and maybe others)
adjusting the number of initial guesses
specifying whether guesses of length are allowed
specifying whether non-list guesses are allowed
(possibly) choosing formatting options (colors, etc.) for the game itself
Special thanks to Bob Sandheinrich for finding a coloring error in a previous version of this resource.
Despite its awesomeness, the recent blog implementation by David Reiss is totally independent from this resource. Even so, the author thanks David for his generous conversations concerning Wordle and this resource in particular.
Many thanks to the WFR Reviewers for their feedback and improvement suggestions. The implementation is much better now than it was before review.

License Information