General Discussions

Discuss a wide range of topics! Questions about the Alteryx Platform should be directed to the appropriate Product discussion forum.

Wordle in Alteryx!

bflick
7 - Meteor

Hey all,

 

I along with many others have added a daily game of Wordle to my morning routine. Inspired by the BaseA challenge for the Advent of Code and exploring the art of what is possible within Alteryx I journeyed down the path of building the game of Wordle in Alteryx. It ended up being an interesting use of chained apps and some of the reporting tools.

 

For those who don't know Wordle is a basic word puzzle game with a cool backstory.  The basic premise is you need to guess a "random" 5 letter word within 6 guesses. Each day a new word is available for you to try to guess. Everytime you guess you get the following information:

  1. The letter in the position you guessed will be highlighted green if that letter is in the target word in the correct position and location
  2. The letter in the position you guessed will be highlighted yellow if that letter is in the target word but a different position
  3. The letter in the position you guessed will be highlighted grey if that letter isn't in the target word

Example from 1/14/2022 (Warning spoiler of the answer)

Spoiler
bflick_0-1642184696351.png

 

This seemed like an interesting challenge for Alteryx. So I set upon my journey to build Wordle in Alteryx.

 

Getting the Word List

The first step in rebuilding Wordle was to get the list of words that are approved and that will be tested. Spoiler for major Wordle fans below

Spoiler
Inside the Wordle website code (inspect element) is a link to the underlying dictionary to the game. The dictionary is also the order in which the words appear daily. You can do your own sleuthing to find the list if you want inside the HTML.

Once we have the dictionary we have to apply the date to the list that way the Alteryx version and the website will display the same word when you're playing the game (I'm sure there are some time zone games that can be played so the words won't align, but I'm not dealing with time zones for a fun project). 

 

So now we have a dictionary of words that can be entered by the user as a guess and the target word that the user is guessing that will change daily.

 

User Input

The first part of the build was designing the user input. Simple enough allow only 5 letter words on the dictionary list. Should be a simple task but as anyone who knows UX design will tell you users love to do everything except what you want. So how I reigned my users in:

  1. Allowing only 5 letter words
    1. Using the Error Message tool I leaned on some Regex to test that the user was truly inputting a 5 letter word. No sneaky special characters or numbers
      1. length(regex_replace([#1],"[^a-Z]",""))!=5
  2. Words only from the dictionary
    1. I tried to use the error message tool, but it turns out Alteryx is not a fan of having an IN statement with 8,000+ words
    2. Simple enough just run the selected word against the dictionary using a join. If the words not on the list throw an error

Logic Gates

The logic was pretty simple. Parse the word into it's letter components. Join the input word against the target word and apply a formula:

IF [Input Value] = [Test Value]
THEN 2
ELSEIF contains([Test],[Input Value])
THEN 1
ELSE 0
ENDIF

 

Reporting

I kept it very basic and built out 2 reports:

  1. Guess Report
    1. This report tracks your guess and does the background coloring based on what you guesses
    2. It keeps a log of previous guesses for you information
  2. Congratulations Screen
    1. If you get the word you'll also have a congratulations screen appear. 

Making the game

To make the game you just need to repeat the above steps. The only change is creating a log to keep track of guesses and updating the reporting so it can handle multiple rounds of data.

 

I've attached the packaged chained apps. I'm sure there are a few ways to approach this and ways to clean up and optimize. Would love to hear others thoughts!

 

 

2 REPLIES 2
patrick_digan
16 - Nebula
16 - Nebula

@bflick Cool! When I first stumbled onto Wordle, I too thought of Alteryx but in a different light. I grabbed the 5 letter words from challenge 75 and built a little interface to have alteryx try and play Wordle. I'm not sure how efficient it is, but it was able to successfully get the handful of days I've tried so far!

DataCurious_Shaan
7 - Meteor

@bflick  Great post very innovative.

 

For those interested in solving Wordle, have a read over at datacurious.ai: https://blog.datacurious.ai/down-the-rabbit-hole-17th-january-2022-4af1e7c8693c

 

Shaan

Co-Founder datacurious.ai