Start with input for an integer seed for the random number generator. There is no need to put a prompt before the cin operation. 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. INPUT VALIDATION: Make sure the user has typed either y, Y, n, or N Create a variable to keep track of the number of guesses the user has made. Use the random number generator to pick a word from the list of words. 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. Display to the user the number of characters in the code.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Scrambled Codewords C++

           

  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.
    1. 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
    1. INPUT VALIDATION: Make sure the user’s guess has the same number of characters as the code.
  9. Process the guess
    1. If the player’s guess matches the code, the player wins, and the game is over.
    2. 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.
      1. Create a display like the one pictured below to show the user information about their guess and clues to the code.
      2. An x in a position means that the character is correct and in the right place.
  • An o in a position means that the character is correct and in the wrong place
  1. An _ means the character is not in the code.
  1. Continue obtaining guesses from the user until they either guess the code or enter the # to indicate they quit.
  2. 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.
  3. Then ask the user if they would like to play again.
  4. You must use at least three functions. Some function examples could be:
    1. Scramble word, fill word list, check guess.
  5. Display the number of guesses between incorrect guesses.
  6. Limit the number of guesses to 10 before the player loses. (Extra Credit)
  7. If the player correctly guesses the code give them 5 chances to unscramble the word. (Extra Credit).
  8. 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).
Sample Run:
Would 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 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 - - o xX
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 o0 _ 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
Transcribed Image Text:Sample Run: Would 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 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 - - o xX 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 o0 _ 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
Your codeword was crueed
It was created from reduce
Would 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.
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 codeword was crueed It was created from reduce Would 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. 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education