Page 1 of 1

Write a program to play Wordle, a letter-by-letter word guessing game. Come up with a set of words that of the same leng

Posted: Fri Jul 01, 2022 5:51 am
by answerhappygod
Write a program to play Wordle, a letter-by-letter word guessinggame.
Come up with a set of words that of the same length - 4, 5, 6 or7 letters long.
Put these set of words in one array or vector. Pick an answerword, then let the user
guess the letters in the word. After each guess, show status foreach guessed letter:
1) letter is in the word and is in the correctplace
2) letter is in the word and is NOT in thecorrect place
3) letter is NOT in the word
The user enters guessed words until the guessed word ismatches the answer word.
Implementation Requirements:
1) Use one or more classes; with 1 or more ofeach: constructor(s), setter(s), getter(s)
2) Use one or more enums (avoid magic numberslike 0, 1, 2, 3, ...)
Eg: {Match, PartMatch,NoMatch}; {Start, Run, Quit}; {Place, Show, Absent}; {Red, Green,Yellow};
3) Use one or more arrays or vectors to storemultiple guesses, multiple words, etc.
4) Good user interface: self-documenting, noinfinite loops, no halts, hangs, crashes, etc.
User should be able to quitgracefully and soon without getting stuck in game.
5) Provide a score at the end.
Variations up to the programmer:
1) Length of word, but should be: 4, 5, 6, 7 (notlonger or shorter)
2) Number of words to offer to user, expect 5 to10.
3) How to handle user input if word guess is NOTsame length as answer word
4) How easy or difficult, hints (for testingpurposes, nice to know answer to verify status)
5) How to quit early (sentinelrecommended)
6) How to display status of guess word (numbers,symbols, colored letters, etc.)
You must use a programmer-defined class for this lab,with constructor(s), setter(s) and getter(s)! Youcan calculate and return the state of the Wordle using publicmember functions of class Wordle.
Game play example (can show status with numbers, letters,colored letters
Sample output: the code should produce this
Welcome to Wordle!
Guess a word, letter by letter. Checkstatus for:
correct letter and position; correctletter but wrong position; letter not in word.
Hint #1: Here are the words to choose from:
anvil bloke crumb dutch fruit shirt
Hint #2: Start guessing this word #1: anvil
(q:quit this word; Q:Quit entiregame.)
Guess 5 letters: vlenio
Guess #1 vlenio status: 0 4 2 ??X??X vlenio
Guess 5 letters: anliv
Guess #2 anliv status: 3 2 0 !!?!? anliv
Guess 5 letters: anvil
Guess #3 anvil status: 5 0 0 !!!!! anvil
-------------------
Hint #2: Start guessing this word #2: bloke
(q:quit this word; Q:Quit entiregame.)
Guess 5 letters: axyzo
Guess #1 axyzo status: 0 1 4 XXXX? axyzo
Guess 5 letters: oblke
Guess #2 oblke status: 2 3 0 ???!! oblke
Guess 5 letters: bloke
Guess #3 bloke status: 5 0 0 !!!!! bloke
-------------------
Hint #2: Start guessing this word #3: crumb
(q:quit this word; Q:Quit entiregame.)
Guess 5 letters: Q
-------------------
Final score: 2 of 2 is 100.00%
Bye. Thanks for playing.
--------------------------------
Process exited after 48.78 seconds with return value0
Press any key to continue . . .
Start out by displaying a short intro with briefinstructions to play the game Wordle. Ask for the first guess.Determine the status of the guess (3 numbers are OK) and displayit. Repeat. Let the user guess several times. Allow the player tostop the game immediately without guessing theword.
In addition to Basic, keep score. How many guesses wereneeded to get the word? How many correctly guessed? Handle scorecorrectly if user quits early. If user quits early and does NOTmake a guess on a word, do not mark that missed word against theuser.
Play several games using different words. Keep score ofhow many words the user guessed correctly. Provide percentage ofwords guessed correctly / words presented / percentage correct. Becareful to avoid divide by zero if user quit early.
Provide status that shows symbols for each letterposition based on the guess. The status symbols indicate whetherthe letter is placed correctly; present but in wrong place, orabsent from the word. Choose appropriate punctuation symbols. Thiscan be done for Mac, Windows, Linux
Use different colors of characters to indicate whetherthe letter is placed correctly; present but in wrong place, orabsent from the word. This option is available only forWindows environments. Use an enumerated type to name the colors andavoid "magic numbers". This makes the code moreself-documenting.
Please do everything mentioned above, the codeshould produce the mentioned output above.
Please read the bolded parts
Implementation Requirements:
1) Use one or more classes; with 1 or more ofeach: constructor(s), setter(s), getter(s)
2) Use one or more enums (avoid magic numberslike 0, 1, 2, 3, ...)
Eg: {Match, PartMatch,NoMatch}; {Start, Run, Quit}; {Place, Show, Absent}; {Red, Green,Yellow};
3) Use one or more arrays or vectors to storemultiple guesses, multiple words, etc.
4) Good user interface: self-documenting, noinfinite loops, no halts, hangs, crashes, etc.
User should be able to quitgracefully and soon without getting stuck in game.
5) Provide a score at the end.