{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CS 31 Project 5 Specs &amp; Solution

# CS 31 Project 5 Specs &amp; Solution - Programming...

This preview shows pages 1–3. Sign up to view the full content.

Programming Assignment 5 Mystery Word Time due: 9:00 PM Tuesday, November 15 You have been contracted by the producers of the highly-rated Mystery Word TV game show to write a program that lets fans play a home version of the game. Here's how one round of the game works: The computer picks a mystery word of four to six letters and tells the player how many letters are in the word. The player tries to determine the mystery word by presenting the computer with a series of trial words. Each trial word is a four to six letter word. If the trial word is the mystery word, the player wins. Otherwise, the computer responds to the trial word with an integer from 0 to the length of the mystery word, indicating the number of letters in the trial word that are in the mystery word. For example, if the mystery word is EAGER, the response to the trial word GOOSE would be 2 (because of the G and one E), the response to EERIE would be 3 (the R and two Es), the response to GAME would be 3 (the G, the A, and the E), the response to BONUS would be 0 (no letters in common), and the response to AGREE or to GREASE would be 5 (one A, one G, one R, and two Es). The player's score for each round is the number of trial words needed to get the correct word (counting the trial word that matched the mystery word). Your program must start by asking the player how many rounds to play, and then play that many rounds of the game. After each round, the program must display some statistics about how well the player has played the rounds so far: the average score, the minimum score, and the maximum score. Here is an example of how the program must interact with the player (player input is in boldface ): How many rounds do you want to play? 3 Round 1 The mystery word is 5 letters long Trial word: assert 3 Trial word: xyzzy I don't know that word Trial word: bred 2 Trial word: mucus 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
never 4 Trial word: enter 3 Trial word: raven You got it in 7 tries Average: 7.00, minimum: 7, maximum: 7 Round 2 The mystery word is 5 letters long Trial word: eerie 3 Trial word: game 3 Trial word: agree 5 Trial word: eager You got it in 4 tries Average: 5.50, minimum: 4, maximum: 7 Round 3 The mystery word is 4 letters long Trial word: monkey 0 Trial word: Hello Your trial word must be a word of 4 to 6 lower case letters Trial word: what? Your trial word must be a word of 4 to 6 lower case letters Trial word: wrap-up Your trial word must be a word of 4 to 6 lower case letters Trial word: stop it Your trial word must be a word of 4 to 6 lower case letters Trial word: sigh You got it in 6 tries Average: 5.67, minimum: 4, maximum: 7 You can assume the user will always enter an integer for the number of rounds (since you haven't learned a clean way to check that yet). If the number of rounds entered is not positive, write the message The number of rounds must be positive and end the program. In order for us to thoroughly test your program, it must have at least the following
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 11

CS 31 Project 5 Specs &amp; Solution - Programming...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online