The codewords will be scrambled words. You will read the words used for the codes from a file and store it into an array. There are 60 words in the file that range in size from 3 characters to 7

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
1. The codewords will be scrambled words. You will read the words used for the codes from a file and
store it into an array. There are 60 words in the file that range in size from 3 characters to 7
characters. The file is called wordlist.txt and can be found attached to the assignment in IvyLearn.
2. Start with input for an integer seed for the random number generator. There is no need to put a
prompt before the cin operation.
3. Ask the Player if they are ready to play and only proceed if they type a Y or y. If the user types an N
or n then the program should finish.
a. INPUT VALIDATION: Make sure the user has typed either y, Y, n, or N
4. Create a variable to keep track of the number of guesses the user has made.
5. Use the random number generator to pick a word from the list of words.
6. Once you have chosen a word as the codeword you will need to scramble the letters to make it into a
code. You should use the random number generator to help you mix up the letters.
7. Display to the user the number of characters in the code.
8. Ask the user to guess the code
a. INPUT VALIDATION: Make sure the user’s guess has the same number of characters as the
code.
9. Process the guess
a. If the player’s guess matches the code, the player wins, and the game is over.
b. If the player’s guess doesn’t match, update the display with information about how close they
are to a correct guess. Check the guess character by character against the code.
i. Create a display like the one pictured below to show the user information about their
guess and clues to the code.
ii. An x in a position means that the character is correct and in the right place.
iii. An o in a position means that the character is correct and in the wrong place
iv. An _ means the character is not in the code.
 
 
 
 
 
 
 
10. Continue obtaining guesses from the user until they either guess the code or enter the # to indicate
they quit.
11. After the player guesses or quits display a message for whether they win or lose(quit), and how
many guesses they took. You should also display the code and the word used to create it.
12. Then ask the user if they would like to play again.
13. You must use at least three functions. Some function examples could be:
i. Scramble word, fill word list, check guess.
14. Display the number of guesses between incorrect guesses.
15. Limit the number of guesses to 10 before the player loses. (Extra Credit)
16. If the player correctly guesses the code give them 5 chances to unscramble the word. (Extra Credit).
17. Let the player choose the difficulty of the word/code. The words in the file are in order by size. The
first 20 words are easy(small), the second 20 words are medium difficulty, and the last 20 words are
hard. (Extra Credit).
Your code is 4 characters long
Please make your guess or enter # to stop: abcd
You have guessed 1 times
You entered abcd
That is not the code word.
You have 1 correct characters in the right position, and you have e correct characters in the wrong postion.
Comparsion: x
Your code is 4 characters long
Please make your guess or enter # to stop: #
You failed to guess the word. You guessed 1 times
Your codeword was atil
It was created from tail
Nould you like to try again? Enter y or n: n
Transcribed Image Text:Your code is 4 characters long Please make your guess or enter # to stop: abcd You have guessed 1 times You entered abcd That is not the code word. You have 1 correct characters in the right position, and you have e correct characters in the wrong postion. Comparsion: x Your code is 4 characters long Please make your guess or enter # to stop: # You failed to guess the word. You guessed 1 times Your codeword was atil It was created from tail Nould you like to try again? Enter y or n: n
Nould you like to guess a word? (Enter y or n) y
Your code is 6 characters long
Please make your guess or enter # to stop: abcde
The guess must be the same number of characters as your code word.
Your code is 6 characters long
Please make your guess or enter # to stop: abcdefg
The guess must be the same number of characters as your code word.
Your code is 6 characters long
Please make your guess or enter # to stop: abcdef
You have guessed 1 times
You entered abcdef
That is not the code word.
You have 1 correct characters in the right position, and you have 3 correct characters in the wrong postion.
Comparsion: - - 0 0 x _
Your code is 6 characters long
Please make your guess or enter # to stop: cmvued
You have guessed 2 times
You entered cmvued
That is not the code word.
You have 3 correct characters in the right position, and you have 2 correct characters in the wrong postion.
Comparsion: x _ - • × x
Your code is 6 characters long
Please make your guess or enter # to stop: cursed
You have guessed 3 times
You entered cursed
That is not the code word.
You have 3 correct characters in the right position, and you have 3 correct characters in the wrong postion.
Comparsion: x o o _ x x
Your code is 6 characters long
Please make your guess or enter # to stop: crueed
You guessed the word in 4 tries! You Won!
Your codeword was crueed
It was created from reduce
Nould you like to try again? Enter y or n: y
Your code is 4 characters long
Please make your guess or enter # to stop: abcd
You have guessed 1 times
You entered abcd
That is not the code word.
You have 1 correct characters in the right position, and you have e correct characters in the wrong postion.
Transcribed Image Text:Nould you like to guess a word? (Enter y or n) y Your code is 6 characters long Please make your guess or enter # to stop: abcde The guess must be the same number of characters as your code word. Your code is 6 characters long Please make your guess or enter # to stop: abcdefg The guess must be the same number of characters as your code word. Your code is 6 characters long Please make your guess or enter # to stop: abcdef You have guessed 1 times You entered abcdef That is not the code word. You have 1 correct characters in the right position, and you have 3 correct characters in the wrong postion. Comparsion: - - 0 0 x _ Your code is 6 characters long Please make your guess or enter # to stop: cmvued You have guessed 2 times You entered cmvued That is not the code word. You have 3 correct characters in the right position, and you have 2 correct characters in the wrong postion. Comparsion: x _ - • × x Your code is 6 characters long Please make your guess or enter # to stop: cursed You have guessed 3 times You entered cursed That is not the code word. You have 3 correct characters in the right position, and you have 3 correct characters in the wrong postion. Comparsion: x o o _ x x Your code is 6 characters long Please make your guess or enter # to stop: crueed You guessed the word in 4 tries! You Won! Your codeword was crueed It was created from reduce Nould you like to try again? Enter y or n: y Your code is 4 characters long Please make your guess or enter # to stop: abcd You have guessed 1 times You entered abcd That is not the code word. You have 1 correct characters in the right position, and you have e correct characters in the wrong postion.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY