Message Boards Message Boards

GROUPS:

A Wolfram Language facsimile of Wordle

Posted 4 months ago
5103 Views
|
27 Replies
|
63 Total Likes
|

enter image description here

The popular game Wordle can take up a lot of your time. The author designed it so that it you can only play it once a day, thus saving us from ourselves :-).

Wordle

NYTimes article on Wordle

But I couldn't resist the challenge to create a version of it in Mathematica, just for fun and because I was bored this past weekend.

See the attached notebook and enjoy. Alas, since you can run it any number of times you are only to blame for yourself it you spend too much time on it.

After executing the notebook just execute

MWordle[Deploy]

to bring up the game.

A few additional comments. The notebook MWordle.nb has the option

AutoGeneratedPackage -> Automatic

which causes it, when saved, to create an MWordle.m package file in its same directory.

The code in MWordle.nb is set up as a package with the context MWordleMwordle

If you want to set things up so that the package gets loaded and the MWordle game is automatically launched, do the following.

Create a directory MWordleGame on your disk (The name MWordleGame can actually be whatever you wish.) And in the MWordleGame directory create a new directory called MWordle. (This name must be exactly that so that the MWordleMwordle Context is property respected.) Put the MWordle.nb notebook in the MWordle dierectory, open it in Mathematica and save it so that the MWordle.m file is created in the MWordle directory. Then you can close the MWordle.nb notebook.

Now in your MWordleGame directory save a new notebook -- you can call it whatever you wish, but something like LaunchMwordle.nb is a sensible choice.

In that notebook create a button with the following command:

CellPrint[TextCell[Button["Launch MWordle",
   Monitor[
    If[! MemberQ[$Path, NotebookDirectory[]], 
     AppendTo[$Path, NotebookDirectory[]]];
    Needs["MWordle`MWordle`"]; MWordle`MWordle`MWordle[Deploy],
    Row[{ProgressIndicator[Appearance -> "Necklace", 
       ImageSize -> Small], Spacer[5], 
      Style["Launching MWordle...", 12, Blue, 
       FontFamily -> "Arial"]}]],
   Method -> "Queued"], "Text", GeneratedCell -> False, 
  CellAutoOverwrite -> False]]

You now have a button in your LaunchMwordle.nb notebook which you can use any time you want to launch MWordle without having to execute the cells in the MWordle.nb notebook.

Download the actual notebook from the link at the end of this post. The following is a version here to read.