Wordle #
In this project, you will experience the IB IA structure and develop the code for a game based on the NYT Wordle.

Syllabus Topics [SL] #
- B1.1.4 Trace flowcharts for a range of programming algorithms.
Syllabus Topics [HL] #
- B4.1.1 Explain the core principles of ADTs
[0] Set up #
๐ป Go to your
dpcs/unit00_strings
folder.
cd ~/desktop/dpcs/unit00_strings/
git clone https://github.com/isf-dp-cs/project_wordle_yourGithubUsername
๐ป In the Terminal, type the following command to open the lab folder.Below you’ll see that the
git clone
command has ayourGithubUsername
.You need to replace this with your username
e.g.
https://github.com/isf-dp-cs/project_wordle_emmaqbrown
cd project_wordle_yourGithubUsername
๐ป Enter the Poetry Shell to start the lab. As a reminder, we will run this command at the start of each lab, but only when we are inside a lab folder.
poetry shell
๐พ ๐ฌ Exiting the poetry shellWhen you want to exit the shell, you can type
exit
or^D
[1] Criteria A: Problem Specification #
The Problem Specification is where you outline the description of your problem and how the product will address it.
In this lab we will focus on the Success Criteria. The Success Criteria measuare outcomes of the solution requirement.
โ CHECKPOINT:๐ Open the
Wordle IA
document in your Google Drive and review the Sucess Criteria.
[2] Criteria C: System Overview #
The System Overview should enable another developer to recreate the product. It should include system models, algorithms, and a testing strategy.
Flowchart #
๐ First, let’s consider the game logic by looking at the flow chart.

Psuedocode for the color formatting #
You may noticed the logic for the process guess and format color
does not include details. This is becuase, sometimes psueodocode is better suited for communicating an algorithm.
โ CHECKPOINT:โ๏ธ In the Criteria C Pseudocode section
World IA
document, write psueodocde for processing the guess and formatting the color.
[3] Criteria D: Development #
Development is where you actually create the product. You must justify your Success Criteria and demonstrate your ability to pass the tests outlined in the Testing Strategy.
๐พ ๐ฌ Choose your own adventure๐ป Follow along coding each success criteria.
It is your goal to complete as many success claims as you can. Test each one before moving onto the next.
Success Criteria 1: User Input #
Success Criteria: The game allows the user to input guess
Success Criteria 2: Correct User Guess #
Sucess Criteria: The game provides output and the game stops if the user has successfully guessed the word
๐ป Edit the loop so that if the user guesses correctly, it will end early.Success Criteria 3: Guess Limit #
Right now, the user can guess infinitely. However, if they guess correctly, the loop should end early.
Succes Criteria: The game ends if the user guesses 6 times and outputs the correct word
Success Criteria 4: Random Word #
Success Criteria: The game randomly selects a word from a list of possible words
Success Criteria 5: Color Feedback #
A big part of Wordle
is the feedback from the game. After each guess, the user is shown their guess, and each letter is highlighted according to these rules:
- GRAY backround: guess letters not included in the word
- YELLOW backround: guess letters in the wrong location
- GREEN backround: guess letters in the correct location
Here are some ANSI codes for you to use:
String gray = "\u001b[47;1m";
String yellow = "\u001b[43;1m";
String green = "\u001b[42;1m";
String reset = "\u001b[0m";
Success Criteria 6: Error Handling #
Sucess Criteria: The game includes error handling if the user input contains too few or too many letters
Example Completed Game

โกโจ Once you complete the lab, be sure to complete these two steps:โ๏ธ Go to your Syllabus Content Checklist in your Google Drive and update it accordingly.
๐ป Push your work to Github
- git status
- git add -A
- git status
- git commit -m "describe your code here"
- git push
- git remote
[4] Criteria E: Evaluation #
The evaluatioin of the product must evaluate if the Success Criteria were met and consider future improvements to the product.
โ CHECKPOINT:โ๏ธ Fill out Criteria E on your document
[5] HL: Abstract Data Types (ADTs) #
Sets #
Wouldn’t it be great if we had a Wordle helper program that could give a list of the possible words every round?
A Set
is perfect for this situation.
๐ป In the file word_finder.py
, finish the function get_possible_words()
.
- inputs: a string of good letters, a string of bad letters, and a list of five letter words
- output: a list of possible words
It uses sys
to access command line arguements to easily run the program from the Terminal. The first arguement represents good letters (letters in the word) and the second arguement represents bad letters (letters not in the word). Here is how to run the file.
$ python word_finder.py rog asefn
['glory', 'gourd', 'groom', 'group', 'grout', 'growl', 'rigor', 'rough']
Consider which Set operations to use. Take a look this resources for how to use a Set in Python.
union
- join two setsintersection
- find common valuesdifference
- only items from first setsubset
- if all of items in first set are in second setsuperset
- if all items of the items in the second set are in the first set
๐พ Test your word_finder.py
with the real
Wordle! Consider, how you could rank the possible words in best to worst?
โกโจ๐ป Push your code to GitHub!