ECE 272 Organization of Computers Spring 2022ECE 2220 System Programming Concepts2 of 3 Lab 5 – Strings – Wordle Cheater In this lab, each student is to write a program called p5.c that allows the...

1 answer below »
I need to make a wordle program in c-language with comments


ECE 272 Organization of Computers Spring 2022ECE 2220 System Programming Concepts2 of 3 Lab 5 – Strings – Wordle Cheater In this lab, each student is to write a program called p5.c that allows the “player” running the program to win at the online word game “Wordle” found at https://www.nytimes.com/games/wordle/index.html The program’s function is to have the player guess wordle’s five-letter word by providing all possible word choices for successive player guesses. The programmer should exhibit a proficiency in: · Operations on Arrays and Strings · String and Character Functions · Command Line Arguments · Dynamic Memory Allocation · File Operations · Scaling Program Parameters · Calculating and Storing Statistics · Formatted Output Background Wordle is an interactive online game that lets the user guess a five-letter word chosen each day as the player receives feedback about their guesses. After each guess, the game tells the user: · which letters of the guess word are present in their correct position, denoted by a green tile. · which letters are not present in the word anywhere, denoted by a gray tile. · which letters are present in the word but are not in their correct position, denoted by a yellow tile. For example, consider the iteration of guesses shown below. For the first guess “TIGER” is chosen of course and the feedback is shown in the table and keyboard: Then a second guess, “ARISE”, seems appropriate and the feedback is shown again: I’ll try another appropriate word, “PRIDE”, this time and the feedback is below: And finally, a guess of “BRINE” is picked (which is what smart Tigers always do before they cook their chicken), and it tells me I’m a winner (which all Tigers already know): Operation The program is to input three command line arguments: p5 dictionary letters guesses The first is the path and name of the dictionary file, dictionary, to be used to suggest guess words. The second argument is the number of letters in the word, from 3 to 12. (For Wordle this will be always be 5, but this program is to be more versatile). The third argument is the number of guesses allowed in the game, also from 3 to 12. (For Wordle this will always be 6, but this program is to be more versatile.) The program should read all words from the desired dictionary that meet the letter length requirement. These words should be stored into a dynamically allocated array of pointers to strings, e.g. char *LengthNWords[NUM_WORDS] These words will be used to suggest guesses for each iteration after the first guess. The program should next prompt the player each turn to enter an n -letter word for their guess. The prompt for input should repeat until a valid n -letter word is provided that is present in the array of n-letter dictionary words. After inputting each guess, the program should echo the guess input in all capital letters and then allow the player to input which letters are present and which are not. (This information would be provided by Wordle if playing the game.) This will be denoted by letting the player input characters under each letter of the word. If the letter is present in the correct position, a caret, or hat (^), should be displayed under the letter. If the letter is present but is not in the correct position, a greater than symbol (>) should be displayed under the letter. And if the letter is not present, a capital x (X) should be displayed under the letter. From the earlier example, if the game word happens to be “BRINE” and the first guess is “TIGER”, then the program would input the following characters under the guess: Guess 1 = TIGER Feedback: x>x>> After displaying this information, the program should iterate through all n-letter words and print out all words that meet the letter information input. These words should be printed out in columns to save space. For the above example, the valid possible words would be: Valid Word(s) Found: AFIRE ARISE BRIBE BRICE BRIDE BRINE CRIME DRIVE EERIE ERICH ERNIE ERVIN ERWIN FERMI HEIRS HENRI IRENE LOIRE MARIE PERIL PRICE PRIDE PRIME PRIZE RAISE REICH REINS RELIC RESIN RHINE ROSIE SERIF SHIRE SPIRE URINE VERDI WEIRD ZAIRE If we chose the first word above, “ARISE”, for our second guess, then we would print out the following, and input a “x^^x^” for the feedback: Guess 1 = TIGER Guess 2 = ARISE Feedback: x^^x^ And the following two words would now be the only valid words in the dictionary: Valid Word(s) Found: BRIBE BRICE BRIDE BRINE CRIME DRIVE PRICE PRIDE PRIME PRIZE URINE If we now guess the second word above, “PRIDE”, we would print out the following, and Wordle would tell us a resulting input of “x^^x^” would be necessary: Guess 1 = TIGER Guess 2 = ARISE Guess 3 = PRIDE Feedback: x^^x^ The possible valid words are shrinking fast with the following list: Valid Word(s) Found: BRIBE BRICE BRINE CRIME URINE And now we’ll choose the word which makes me think of some good ole smoked chicken which results in the feedback “^^^^^” since it’s the Wordle game word: Guess 1 = TIGER Guess 2 = ARISE Guess 3 = PRIDE Guess 4 = BRINE Feedback: ^^^^^ Once the Feedback entered shows the guess to be correct, the program should ask the player if they would like to play again, and continue if they choose to do so: You Win!!! Do you want to play again? (y/n) Note that this program can now be used to “cheat” at Wordle allowing the player to know all the possible word choices (in the given dictionary) meeting revealed requirements, though I just prefer to call it “[ECE] educated guessing” instead of “cheating.” Bonus Points For bonus points the, after storing the dictionary words, the player should be prompted whether they wish to use the game to help play Wordle, or to have it randomly choose its own word to guess. If the player decides to let the game choose the word, the program should choose a random word from the list of all n-letter words, and then use its own logic to print out the feedback for each guess instead of having the player input the feedback from Wordle’s feedback. The program could also print out a character map after each guess showing which letters are used and which are not, which would help the programmer validate the functionality of the program. For example, in the previous example, the results for each iteration would be: Guess 1 = TIGER Feedback: x>x>> ABCDEFGHIJKLMNOPQRSTUVWXYZ Used: E I R Not Used: G T Guess 1 = TIGER Guess 2 = ARISE Feedback: x^^x^ ABCDEFGHIJKLMNOPQRSTUVWXYZ Used: E I R Not Used: A G ST Guess 1 = TIGER Guess 2 = ARISE Guess 3 = PRIDE Feedback: x^^x^ ABCDEFGHIJKLMNOPQRSTUVWXYZ Used: E I R Not Used: A D G P ST Guess 1 = TIGER Guess 2 = ARISE Guess 3 = PRIDE Guess 4 = BRINE Feedback: ^^^^^ ABCDEFGHIJKLMNOPQRSTUVWXYZ Used: B E I N R Not Used: A D G P ST For further bonus points, the program could print out after each guess a list of the most common character in each letter position for the valid words found. For previous example, the first guess results would be: ABODE AHEAD AMEND ANDRE ANODE Most Common Letter in position 1 is A Most Common Letter in position 2 is N Most Common Letter in position 3 is E Most Common Letter in position 4 is D Most Common Letter in position 5 is E And if you really feel creative, you may wish to extend your program to work with Quordle! https://www.quordle.com/#/ Further Considerations Your program should be structured neatly, easily readable, and well commented. Furthermore, variable and function names should be such that the software is as “self-commenting” as possible. Creation and Submission Work must be completed by each individual student, and only that student. Students must not use code from another student or copied from a book or internet source. Students must not allow other students to copy from their code or make it possible for students to do so by making their code available to be copied. Sharing of code will not be tolerated and will be tested for. Any such act of cheating will result in failing the class and may result in dismissal from the University. Use the following line to compile your program gcc -Wall -g p5.c -o p5 The code you submit must compile using the –Wall flag and no compiler errors or warnings should be printed. To receive credit for this assignment your code must compile and at a minimum perform some required function. Code
Answered 2 days AfterMar 28, 2022

Answer To: ECE 272 Organization of Computers Spring 2022ECE 2220 System Programming Concepts2 of 3 Lab 5 –...

Sathishkumar answered on Mar 30 2022
109 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here