Intro to Java classes create their own Wordle
April 5, 2022
The Introduction to Java class completed a month-long project on March 4 to code their own Wordle, a word-guessing game that has gone viral with millions of players daily. The goal of the project was for students to take what they had learned so far in class to construct a game and further familiarize themselves with coding while simultaneously becoming more creative in their code.
Surging to popularity due to its simplicity, the game features a new five-letter word each day for players to try to guess within six attempts. Letters within each guess are marked gray to mean the letter is not in the word, yellow to mean it is in the word but not in the right position and green to mean it is in the word and in the correct position.
“I enjoy the feeling of anticipation when I get closer and closer to guessing the Wordle,” sophomore Sanika Iyer said. “Additionally, I’ve always loved word games, and playing Wordle expands my vocabulary and makes me feel productive.”
In the Intro to Java class, students initially spend the majority learning Python, then slowly transition to using Java. The creation of a personalized Wordle was the capstone project in Python for the class this year; students in previous years have tackled projects such as Blackjack, Poker and Set.
“I was thinking about this year and was not sure what to do, and then I just kind of came across this popular game named Wordle,” Intro to Java teacher Mark Kwong said. “I always try to find a game that is not too hard but not too easy either, and Wordle is very relevant right now for the students.”
Students encountered issues with their code that they had to resolve on their own. One challenge when coding was writing the code for a specific case of when repeated letters were guessed by the player.
“The corner case of repeated letters took the longest for me to debug,” Iyer said. “Let’s assume that the wordle of the day was ‘apple’, and the word guessed was ‘poppy’. Making sure that only two P’s were colored correctly was one of the hardest parts of the project for me.”
After completing the requirements, students were encouraged to include additional creative features to their program.
“The best part of the project was adding features, because we were given a lot of freedom to not only build the ideas we wanted but to also use resources and tools outside what we had already learned in class,” sophomore Anshul Singh said. “We added additional features such as a dictionary, customized difficulty level, a timer and hints for the player.”
Some noteworthy features that students incorporated into their code to included a version that ranged from two to six random words to be guessed simultaneously. While the basic requirement was to design a text-based game, several students integrated a graphical user interface for players to manipulate when guessing their word. Other students built a variety of modes for players to choose from, ranging from easy to difficult, as well as a point counter to keep track of how many guesses players have made. Some students even added a rage quit mode, for players who wanted to really push themselves.
Although the project was challenging, students expanded on their capabilities and discovered the satisfaction of programming a game with minimal help.
“Through the project, I gained more knowledge on Python: how to use classes, the purpose of classes and functions, the various data types in Python and a real world application of Python,” junior Ryan Wang said.