Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

> CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 1/4 | - 184% + 10 + Program #2 - Due 26

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

> CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 1/4 | - 184% + 10 + Program #2 - Due 26 March 2021 CSC 170/111 Your assignment is to write a program that will mimic the gameshow Wheel of Fortune. A random phrase with associated category will be chosen from a list of 10 different options. You will then display a welcome message ("Wheel of Fortune), followed by an empty board with underscores where letters belong and spaces where they do not (no punctuation or multiple lines are required), followed by the category centered at the bottom of the board. The user will then be presented with a menu of options with a prompt asking what they'd like to do (in your best Pat Sajak voice of course) both of which are illustrated below. Wheel of Fortune Before and After 1. Soin Type here to search O 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 1/4 | - 184% + 10 + Before and After 1. Spin 2. Solve 3. Quit Game What would you like to do? User Selection Spin: If the user chooses to spin, you will display what value their spin was worth as if they actually "spun the wheel". These values are stored in a list of integers (provided) that correspond to the dollar amounts commonly found on the wheel (see below). $ LOSE S ciu PLAY BANDAH Oocon C MUCXZW weeo Type here to search O 1:29 PM 3/18/2021 > CSC 170 Program 2 X c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 1/4 184% + + of) HWCXZW TU OOM Ociou OOO You'll notice that there are 24 different "values", two of which are bankrupt, one lose a turn, and one free play (this has been replaced with a dollar value). If the user's spin lands on bankrupt, you will display a message letting them know they just went bankrupt and you will clear their bank account to zero. If the user's spin lands on lose a turn, you will display a message they have lost their turn but this has no effect on the accumulation of their bank account. If the user's spin lands anywhere else, you will display the associated dollar amount Type here to search Ei 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 2/4 | - 184% + 1 0 and then promped them for a letter (in this version of Wheel, you do not have to "buy a vowel, they are free of charge). Once a letter has been chosen, you will compare this letter to each letter in the phrase and respond accordingly (suppose the player chooses the letter Z): If the letter is not in the puzzle, you will simply respond "Sorry, there is no Z". They will not accumulate the dollar amount in their bank for a missed letter. You will then display the menu options again and ask them what they'd like to do (see below). 1. Spin 2. Solve 3. Quit Game What would you like to do? 1 Spin = $700 Guess Letter: 2 Sorry there's no 7 Type here to search O Ei 1:29 PM 3/18/2021 > CSC 170 Program 2 X c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 2/4 | - 184% + + What would you like to do? 1 Spin = $700 Guess Letter: z Sorry, there's no Z 1. Spin 2. Solve 3. Quit Game What would you like to do? | If the letter is in the puzzle, you will count how many occurances there are, this will be a multiplier for the dollar amount their spin landed on which will be added to the accumulation of their bank account. You will then update the board to display the "new gameboard" illustrating where the letter(s) they have selected reside (you must show all the locations). You will then display the menu options again and ask them what they'd like to do (see below). 1. Spin Type here to search O I 1:29 PM 3/18/2021 > CSC 170 Program 2 X c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 2 / 4 1 - 184% + | 0 + like to do (see below). 1. Spin 2. Solve 3. Quit Game What would you like to do? 1 Spin = $900 Guess Letter: a Wheel of Fortune Before and After Yes, there are 3 A's Your Total is $2700 1. Spin 2. Solve 3. Quit Game What would you like to do? Type here to search O FI 1:29 PM 3/18/2021 CSC 170 Program 2 + c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf @ G CSC 170 Program 2 3/4 1 - 184% + 1 Solve: If the user chooses to solve, you will prompt them to enter the phrase they believe is the solution. You will then compare their solution to the puzzle phrase and respond accordingly. If their guess is correct, you will display a message Congratulations!!!!! Your winnings are $2500" where their winnings will display their accumulated bank total. You will then end the game. If their guess is incorrect, you will display "Sorry, that's not quite correct." You will then display the main menu letting them choose another option. Examples are shown below. Wheel of Fortune Wheel of Fortune ALCA_ _ A_ -_LA_ - On the Map Fun and Games 1. Spin 2. Solve 3. Quit Game Yes, there's one C Your Total is $3500 1. Spin 2. Solve 3. Quit Game What would you like to do? 2 What would you like to do? 2 What's your guess? This is hard Sorry, that's not quite correct. 1. Spin 2. Solve 3. Quit Game What's your guess? Alcatraz Island Type here to search O 9 I 1:29 PM 3/18/2021 > CSC 170 Program 2 c File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 184% + 0 + 3. Vuil baile Your Total is $300 1. Spin 2. Solve 3. Quit Game What would you like to do? 2 What would you like to do? 2 What's your guess? Alcatraz Island What's your guess? This is hard Sorry, that's not quite correct. 1. Spin 2. Solve 3. Quit Game Congratulations!!!!! Your winnings are $ 3500 What would you like to do? | Quit Game: If the user chooses to quit the game, you will simply display a message "Thank your for playing!" and exit the program. Main Program Steps You will be provided with a python file entitled "PhraseGen.py", this file includes three lists (one for phrases, one for their corresponding category, and one for the wheel values) as well as a function called GeneratePhrase. The function takes no arguments but returns the random phrase along with it's corresponding category. This function will be called in your main program to get the puzzle phrase and category for the game. You will import this functionality by adding the following line to the top of your program: Type here to search O 1 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 3/4 - 184% + by adding the following line to the top of your program: from PraseGen import* You will need to write several different functions to accomplish string population, manipulation, and comparisons. At a minimum, you will have the following: spin: Takes a single argument (list of wheel values - provided via the import*), returns a single value in the list (note: -2 implies a bankruptcy and -1 implies a lose a turn, anything else is a dollar value). user_selection: Takes no arguments, displays the menu items above, error checks, and returns the user's selection. build_board_list: Takes two arguments, a puzzle phrase and a list that is allocated to be the size of the puzzle. This function returns the populated list where it will populate the list with "_" (underscore + space) at the index the phrase contains a letter, and " " (space) at the index the phrase contains a space. Type here to search O 1 (4 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 184% + + update_list: Takes three arguments, the puzzle phrase, the allocated list of characters, and a letter guessed by the user. This function returns the updated list of characters where each_ " is replaced with the corresponding letter in the puzzle if there's a match. print_board: Takes two arguments, the list of characters and the category of the phrase. This function does not return anything, it simply prints the board layout (welcome message, underscores and spaces for the phrase, and the category centered below the puzzle). You may also wish to write some helper functions to help ease the burden (recall there are many methods associated with string - use them to your advantage.) Remember, try to functionalize when possible. Timeline: Coh 20 Vaunchould have thamani antion and hoard nrintinacamolotad Type here to search I 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 4/4 184% + + Timeline: Feb. 26: Mar. 5: You should have the menu options and board printing completed. Printing the updated board should be functional when a user guesses a correct letter. Mar. 19: All helper functions should be operational and you should be working through the overall program logic and execution. Mar. 26: Your program is due at midnight. It should be commented, have a program header and function header similar to that of program 1. Comments and suggestions. Do not delay, Start writing the program early. If you wait until the night before the due date, you will have a miserable night. Do not try and write the entire program all at one time. Work on the program in small sections (recall our example of incremental programming), as the timeline indicates. Write ample test scripts (stubs and drivers) along the way to ensure each sub-module is working exactly as Type here to search OS 1:29 PM 3/18/2021 CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 4/4 184% + Comments and suggestions. Do not delay, Start writing the program early. If you wait until the night before the due date, you will have a miserable night. Do not try and write the entire program all at one time. Work on the program in small sections (recall our example of incremental programming), as the timeline indicates. Write ample test scripts (stubs and drivers) along the way to ensure each sub-module is working exactly as expected before moving on to the next module. Notes: Be sure to follow the coding style guidelines that can be found in D2L in Supplemental Materials. Name your program prog2.py. Points will be deducted if this naming convention is not followed. Be sure your code file is readable and neat. Do not allow lines to extend past 80 characters. use appropriate white space. Type here to search I 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 4/4 | - 184% + + expected before moving on to the next module. Notes: Be sure to follow the coding style guidelines that can be found in D2L in Supplemental Materials. . Name your program prog2.py. Points will be deducted if this naming convention is not followed. . Be sure your code file is readable and neat. Do not allow lines to extend past 80 characters, use appropriate white space, Program Submission Submit your program code (the prog2.py file only) in the D2L dropbox by 11:59pm 26 Mar. Type here to search 3 I 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 1/4 | - 184% + 10 + Program #2 - Due 26 March 2021 CSC 170/111 Your assignment is to write a program that will mimic the gameshow Wheel of Fortune. A random phrase with associated category will be chosen from a list of 10 different options. You will then display a welcome message ("Wheel of Fortune), followed by an empty board with underscores where letters belong and spaces where they do not (no punctuation or multiple lines are required), followed by the category centered at the bottom of the board. The user will then be presented with a menu of options with a prompt asking what they'd like to do (in your best Pat Sajak voice of course) both of which are illustrated below. Wheel of Fortune Before and After 1. Soin Type here to search O 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 1/4 | - 184% + 10 + Before and After 1. Spin 2. Solve 3. Quit Game What would you like to do? User Selection Spin: If the user chooses to spin, you will display what value their spin was worth as if they actually "spun the wheel". These values are stored in a list of integers (provided) that correspond to the dollar amounts commonly found on the wheel (see below). $ LOSE S ciu PLAY BANDAH Oocon C MUCXZW weeo Type here to search O 1:29 PM 3/18/2021 > CSC 170 Program 2 X c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 1/4 184% + + of) HWCXZW TU OOM Ociou OOO You'll notice that there are 24 different "values", two of which are bankrupt, one lose a turn, and one free play (this has been replaced with a dollar value). If the user's spin lands on bankrupt, you will display a message letting them know they just went bankrupt and you will clear their bank account to zero. If the user's spin lands on lose a turn, you will display a message they have lost their turn but this has no effect on the accumulation of their bank account. If the user's spin lands anywhere else, you will display the associated dollar amount Type here to search Ei 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 2/4 | - 184% + 1 0 and then promped them for a letter (in this version of Wheel, you do not have to "buy a vowel, they are free of charge). Once a letter has been chosen, you will compare this letter to each letter in the phrase and respond accordingly (suppose the player chooses the letter Z): If the letter is not in the puzzle, you will simply respond "Sorry, there is no Z". They will not accumulate the dollar amount in their bank for a missed letter. You will then display the menu options again and ask them what they'd like to do (see below). 1. Spin 2. Solve 3. Quit Game What would you like to do? 1 Spin = $700 Guess Letter: 2 Sorry there's no 7 Type here to search O Ei 1:29 PM 3/18/2021 > CSC 170 Program 2 X c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 2/4 | - 184% + + What would you like to do? 1 Spin = $700 Guess Letter: z Sorry, there's no Z 1. Spin 2. Solve 3. Quit Game What would you like to do? | If the letter is in the puzzle, you will count how many occurances there are, this will be a multiplier for the dollar amount their spin landed on which will be added to the accumulation of their bank account. You will then update the board to display the "new gameboard" illustrating where the letter(s) they have selected reside (you must show all the locations). You will then display the menu options again and ask them what they'd like to do (see below). 1. Spin Type here to search O I 1:29 PM 3/18/2021 > CSC 170 Program 2 X c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 2 / 4 1 - 184% + | 0 + like to do (see below). 1. Spin 2. Solve 3. Quit Game What would you like to do? 1 Spin = $900 Guess Letter: a Wheel of Fortune Before and After Yes, there are 3 A's Your Total is $2700 1. Spin 2. Solve 3. Quit Game What would you like to do? Type here to search O FI 1:29 PM 3/18/2021 CSC 170 Program 2 + c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf @ G CSC 170 Program 2 3/4 1 - 184% + 1 Solve: If the user chooses to solve, you will prompt them to enter the phrase they believe is the solution. You will then compare their solution to the puzzle phrase and respond accordingly. If their guess is correct, you will display a message Congratulations!!!!! Your winnings are $2500" where their winnings will display their accumulated bank total. You will then end the game. If their guess is incorrect, you will display "Sorry, that's not quite correct." You will then display the main menu letting them choose another option. Examples are shown below. Wheel of Fortune Wheel of Fortune ALCA_ _ A_ -_LA_ - On the Map Fun and Games 1. Spin 2. Solve 3. Quit Game Yes, there's one C Your Total is $3500 1. Spin 2. Solve 3. Quit Game What would you like to do? 2 What would you like to do? 2 What's your guess? This is hard Sorry, that's not quite correct. 1. Spin 2. Solve 3. Quit Game What's your guess? Alcatraz Island Type here to search O 9 I 1:29 PM 3/18/2021 > CSC 170 Program 2 c File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 184% + 0 + 3. Vuil baile Your Total is $300 1. Spin 2. Solve 3. Quit Game What would you like to do? 2 What would you like to do? 2 What's your guess? Alcatraz Island What's your guess? This is hard Sorry, that's not quite correct. 1. Spin 2. Solve 3. Quit Game Congratulations!!!!! Your winnings are $ 3500 What would you like to do? | Quit Game: If the user chooses to quit the game, you will simply display a message "Thank your for playing!" and exit the program. Main Program Steps You will be provided with a python file entitled "PhraseGen.py", this file includes three lists (one for phrases, one for their corresponding category, and one for the wheel values) as well as a function called GeneratePhrase. The function takes no arguments but returns the random phrase along with it's corresponding category. This function will be called in your main program to get the puzzle phrase and category for the game. You will import this functionality by adding the following line to the top of your program: Type here to search O 1 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 3/4 - 184% + by adding the following line to the top of your program: from PraseGen import* You will need to write several different functions to accomplish string population, manipulation, and comparisons. At a minimum, you will have the following: spin: Takes a single argument (list of wheel values - provided via the import*), returns a single value in the list (note: -2 implies a bankruptcy and -1 implies a lose a turn, anything else is a dollar value). user_selection: Takes no arguments, displays the menu items above, error checks, and returns the user's selection. build_board_list: Takes two arguments, a puzzle phrase and a list that is allocated to be the size of the puzzle. This function returns the populated list where it will populate the list with "_" (underscore + space) at the index the phrase contains a letter, and " " (space) at the index the phrase contains a space. Type here to search O 1 (4 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 184% + + update_list: Takes three arguments, the puzzle phrase, the allocated list of characters, and a letter guessed by the user. This function returns the updated list of characters where each_ " is replaced with the corresponding letter in the puzzle if there's a match. print_board: Takes two arguments, the list of characters and the category of the phrase. This function does not return anything, it simply prints the board layout (welcome message, underscores and spaces for the phrase, and the category centered below the puzzle). You may also wish to write some helper functions to help ease the burden (recall there are many methods associated with string - use them to your advantage.) Remember, try to functionalize when possible. Timeline: Coh 20 Vaunchould have thamani antion and hoard nrintinacamolotad Type here to search I 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 4/4 184% + + Timeline: Feb. 26: Mar. 5: You should have the menu options and board printing completed. Printing the updated board should be functional when a user guesses a correct letter. Mar. 19: All helper functions should be operational and you should be working through the overall program logic and execution. Mar. 26: Your program is due at midnight. It should be commented, have a program header and function header similar to that of program 1. Comments and suggestions. Do not delay, Start writing the program early. If you wait until the night before the due date, you will have a miserable night. Do not try and write the entire program all at one time. Work on the program in small sections (recall our example of incremental programming), as the timeline indicates. Write ample test scripts (stubs and drivers) along the way to ensure each sub-module is working exactly as Type here to search OS 1:29 PM 3/18/2021 CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 4/4 184% + Comments and suggestions. Do not delay, Start writing the program early. If you wait until the night before the due date, you will have a miserable night. Do not try and write the entire program all at one time. Work on the program in small sections (recall our example of incremental programming), as the timeline indicates. Write ample test scripts (stubs and drivers) along the way to ensure each sub-module is working exactly as expected before moving on to the next module. Notes: Be sure to follow the coding style guidelines that can be found in D2L in Supplemental Materials. Name your program prog2.py. Points will be deducted if this naming convention is not followed. Be sure your code file is readable and neat. Do not allow lines to extend past 80 characters. use appropriate white space. Type here to search I 1:29 PM 3/18/2021 > CSC 170 Program 2 c O File C:/Users/101011313/Downloads/Program%202%20(1).pdf CSC 170 Program 2 4/4 | - 184% + + expected before moving on to the next module. Notes: Be sure to follow the coding style guidelines that can be found in D2L in Supplemental Materials. . Name your program prog2.py. Points will be deducted if this naming convention is not followed. . Be sure your code file is readable and neat. Do not allow lines to extend past 80 characters, use appropriate white space, Program Submission Submit your program code (the prog2.py file only) in the D2L dropbox by 11:59pm 26 Mar. Type here to search 3 I 1:29 PM 3/18/2021

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started