User Prompts Your program will allow a human user to play Rock, Paper, Scissors with the computer. At the beginning of the game, the user should be prompted for his/her input. The valid choices for input are: • R or r (Rock) • P or p (Paper) • S or s (Scissors) • Q or q (Quit) Beginning of Round At the beginning of each round your program should ask the user for an input.

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...
icon
Related questions
Question

 

User Prompts
Your program will allow a human user to play Rock, Paper, Scissors with the computer. At the beginning of the game, the user should be prompted for his/her input. The valid choices for input are:
• R or r (Rock)
• P or p (Paper)
• S or s (Scissors)
• Q or q (Quit)
Beginning of Round
At the beginning of each round your program should ask the user for an input.
Invalid Entry
If the user inputs something other than r, R, p, P, s, S, q or Q, the program should detect the invalid entry and ask the user to make another choice.
Round structure
Each round of the game will have the following structure:
1. The program will choose a weapon (Rock, Paper, Scissors), but its choice will not be displayed until later so the user doesn’t see it.
2. The program will announce the beginning of the round and ask the user for his/her weapon choice
3. The two weapons will be compared to determine the winner (or a tie) and the results will be displayed by the program
4. The next round will begin, and the game will continue until the user chooses to quit
5. The computer will keep score and print the score when the game ends
Weapon Selection
The computer should select the weapon most likely to beat the user, based on the user’s previous choice of weapons.
Random Weapon Selection
During rounds when the user does not have a single preferred weapon, the computer may select any weapon.
Quit
At the end of the game (when the user chooses ‘q’ or ‘Q’), your program should display the following:
1. The number of rounds the computer has won
2. The number of rounds the user has won
3. The number of rounds that ended in a tie
4. The number of times the user selected each weapon (Rock, Paper, Scissors)
Looping
Your program should continuously prompt for a command.
Expert Solution
steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY