This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Upgrading Server to version 22.1? We’ve enabled the faster AMP engine by default. Read about how these system settings changes might affect you.
2022-05-24 Updates: Login: If you are facing issues with logging in, please try clearing all your cookies or trying another browser. We have a fix being deployed on the evening of 5/25. Email: If you're not seeing emails be delivered from the Community, please check your spam and mark the Community emails as not junk. Thank you for your patience.
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:
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
The letter in the position you guessed will be highlighted yellow if that letter is in the target word but a different position
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)
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.
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:
Allowing only 5 letter words
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
Words only from the dictionary
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
Simple enough just run the selected word against the dictionary using a join. If the words not on the list throw an error
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
I kept it very basic and built out 2 reports:
This report tracks your guess and does the background coloring based on what you guesses
It keeps a log of previous guesses for you information
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!
@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!
Awesome. I'm diving in then! Today's took me all 6 guesses. It might have helped if I wasn't doing it half an hour after I woke up. On the 4th try I had all but the first 2 letters, and it took me about 7 minutes to make the next 2 guesses. lol