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
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...
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.
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).
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).
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY