Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

RUBRIC: Please follow the below rubrics and make sure to use functions in check_input module(you can find the check_input.py file in the modules section) Lab

image text in transcribed
image text in transcribed
RUBRIC:

Please follow the below rubrics and make sure to use functions in check_input module(you can find the check_input.py file in the modules section)

Lab 2 - Rock/Paper/Scissors - 10 points

1 - 2 points Has weapon_menu function to get user's input. Repeatedly checks for validity that the input is an R, P, S, or B. Returns the valid input.

2 - 2 points Has displayScore function. Passes in the player and computer scores and displays them. Has comp_weapon function. Randomly chooses the computer's weapon and returns either a R, P, or S.

3 - 2 points Has find_winner function. Passes in the player and computer weapon choices. Has if statements to compare those values to display the results and return the winner (0=Tie, 1=Player, 2=Computer).

4 - 2 points Main function has a loop that repeats the main menu until the user quits, as well as a loop that repeats the game (option 1). Displays correct output for user and computer throws, result of the round, and scores. Takes in user input and checks for invalid values using check_input module: 1. Rejects all strings on main menu and integers outside of 1-3 range. 2. Rejects all strings on weapon menu that are not R, P, S, or B

5 - 2 points Code Formatting: 1. Correct spacing. 2. Meaningful variable names. 3. No global variables. 4. Documented functions with docstrings. 5. Added other comments to code.

Rock-Paper-Scissors Write a program that allows a user to play Rock-Paper-Scissors against the computer. Have the program keep score of how many times each has woe a round. Your program should have a main method that has a loop that repeats the game until the user chooses to quit. Display the final score before exiting. Write the following functions: 1. weapon_menu () -Asks the user to input their choice: (R)ock, (P)aper, (S)cissors. or (B)ack. Checks user input for validity and then returas the inputted value. 2. comp_weapon () - Randomly chooses the computer's throw and returns an " R. "P", or "'s". 3. f ind winner (player, comip) - Passes in the two weapons (R, P, or S ), displays the throws, compares the two weapons and displays the result and returns who is the winner of that round ( 0= Tie, I= Player, 2= Conputer). a. Rock crushes Scissors b. Scissors cuts Paper c. Paper covers Rock 4. display_scores (player, comp) - Displays the scores. Example Output (user inpot is in italics): RPS Menu: Computer wins 1. Play gane Choose your weapon: 2. Show Score R. Rock 3. Quit P. Paper 1 S. Scissors Choose your weopon: B. Back R. Rock B P. Paper RPS Menu: S. Scissors 1. Ploy gane B. Back 2. Show Score p 3. Quit You chose Paper 2 Computer chose Paper Player =0 Tie Computer =1 Choose your weopon: RPS Menu: R. Rock 1. Ploy gane P. Paper 2. Show Score S. Scissors 3. Quit B. Back 3 5 Final Score: You chose Scissors Player = 0 Computer chose Rock Computer =1 9. Thoroughly test your program before submitting/demoing. a. Make sure each of your functions returns the correct value. b. Make sure the computer's throw returns a randomly assigned weapon choice. c. Make sure that the correct winner is returned given the rules. d. Make sure that the points are awarded to the correet player after winning a round. e. Make sure that the points displayed are correct. f. Make sure that the game doesn't go back to the main menu until the wier chooses to go back. g. Error check all user input ( 1,2,3 on the main menu, and R.P.S,B on the weapon menu). 10. Feel free to expand the game to be the Rock-Paper-Scissors-Lizard-Spock version. Add new menu options for (L)izard and Spoc(k). The updated set of nules are: a. Rock crushes Scissors b. Rock erushes Lizard c. Paper covers Rock d. Paper disproves Spock e. Scissors cuts Paper f. Scissors decapitates Lieard g. Lizard poisons Spock h. Lizard eats Paper i. Spock smashes Scissors j. Spock vaporizes Rock

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Classify delivery styles by type.

Answered: 1 week ago