To review and practice core Java programming concepts.
For this assignment you will write a Java version of the popular game Wordle. In this game, the player has six tries to guess the randomly chosen 5-letter word.
Each of their guesses must be a real word. After each guess, the player is told if they got any letters exactly right, and whether they got any of the right letters but in the wrong positions.
For example, let's say that the secret word is "noise", and the user guesses "young". They will be told that the 'o' is in the right place. They will also be told there is an 'n', but not in the correct place.
Using this information, the user narrows down what the word can be and hopefully gets the right answer at the end.
You should break the program into at least three different methods, but can use only one class.
Here is an example run so that you can see how this program will work. This is a successful attempt by the user:
You have six tries to guess a five-letter word. What is your guess? adieu The i is right! There is a u but not here. What is your guess? unite There is a u but not here. The i is right! What is your guess? quite The q is right! The u is right! The i is right! What is your guess? quilt The q is right! The u is right! The i is right! What is your guess? quips Congratulations, you got it!
And here is an unsuccessful attempt:
You have six tries to guess a five-letter word. What is your guess? angle The e is right! What is your guess? blame The e is right! What is your guess? trade The t is right! There is a r but not here. The e is right! What is your guess? there The t is right! There is a e but not here. There is a r but not here. The e is right! What is your guess? trite The t is right! There is a r but not here. The t is right! The e is right! What is your guess? treat The t is right! There is a r but not here. There is a e but not here. There is a t but not here. Sorry, the word is torte
When writing your program, also be sure to:
You should submit your program by uploading all of the .java files to Canvas.
Here is a potential solution to this project: Wordle.java.
Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.