The Rock-Scissors-Paper Game, v.1.0 Purpose. Bring together all you've learned so far, about values, variables, sequential processing, code blocks, ifs and loops. The game is played between the computer and a human player.

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
**The Rock-Scissors-Paper Game, v.1.0**

**Purpose:** 
The purpose of this project is to consolidate your understanding of values, variables, sequential processing, code blocks, conditionals, and loops by creating an interactive two-player game between a computer and a human player.

**Requirements:** 
Develop a computer game based on rock-paper-scissors. Reference: [worldrps.com](http://www.worldrps.com). Name the source file `rcp1.cpp`. The game will feature human vs. computer interactivity.

To determine the computer’s choice, a "random number generator" will be utilized, enabling the computer to simulate decision-making.

In the game coding, utilize code blocks, loops, and conditional structures (if/and/or/switch). This approach facilitates the transition to using functions in future programming endeavors. The game continues until the human player opts to quit by inputting 'q'. User inputs involve 'R' or 'r' for rock, 'P' or 'p' for paper, 'S' or 's' for scissors, and 'Q' or 'q' to quit. The computer selects randomly.

Implement score-tracking to tally the number of computer and human wins, excluding ties. Display final scores upon the game’s conclusion.

**Supplemental Reading:** 
Learn more about "randomizing" at [rdb3.com/cpp/exercises/Gaming.supplemental.pdf](http://www.rdb3.com/cpp/exercises/Gaming.supplemental.pdf).

**Algorithm:**

1. Initialize the computer's random number generator.
2. Declare variables to track the number of wins for both humans and the computer.
3. Start the loop:
   - Determine the computer’s choice.
   - Prompt for and read the human's choice.
   - If the human opts to quit, exit the loop.
   - Determine the winner.
4. End loop.
5. Print the number of wins for both the human and the computer.

**Example:**

The provided example illustrates the game interface, inputs, and results:

- Input prompt appears in blue. 
- Human responses are in red.
- Results are displayed in green.

```
Choose: [Rock, Paper, Scissors, Quit]: p
Computer: S, Human: P, Computer wins

Choose: [Rock, Paper, Scissors, Quit]: p
Computer: P, Human: P, tie

Choose:
Transcribed Image Text:**The Rock-Scissors-Paper Game, v.1.0** **Purpose:** The purpose of this project is to consolidate your understanding of values, variables, sequential processing, code blocks, conditionals, and loops by creating an interactive two-player game between a computer and a human player. **Requirements:** Develop a computer game based on rock-paper-scissors. Reference: [worldrps.com](http://www.worldrps.com). Name the source file `rcp1.cpp`. The game will feature human vs. computer interactivity. To determine the computer’s choice, a "random number generator" will be utilized, enabling the computer to simulate decision-making. In the game coding, utilize code blocks, loops, and conditional structures (if/and/or/switch). This approach facilitates the transition to using functions in future programming endeavors. The game continues until the human player opts to quit by inputting 'q'. User inputs involve 'R' or 'r' for rock, 'P' or 'p' for paper, 'S' or 's' for scissors, and 'Q' or 'q' to quit. The computer selects randomly. Implement score-tracking to tally the number of computer and human wins, excluding ties. Display final scores upon the game’s conclusion. **Supplemental Reading:** Learn more about "randomizing" at [rdb3.com/cpp/exercises/Gaming.supplemental.pdf](http://www.rdb3.com/cpp/exercises/Gaming.supplemental.pdf). **Algorithm:** 1. Initialize the computer's random number generator. 2. Declare variables to track the number of wins for both humans and the computer. 3. Start the loop: - Determine the computer’s choice. - Prompt for and read the human's choice. - If the human opts to quit, exit the loop. - Determine the winner. 4. End loop. 5. Print the number of wins for both the human and the computer. **Example:** The provided example illustrates the game interface, inputs, and results: - Input prompt appears in blue. - Human responses are in red. - Results are displayed in green. ``` Choose: [Rock, Paper, Scissors, Quit]: p Computer: S, Human: P, Computer wins Choose: [Rock, Paper, Scissors, Quit]: p Computer: P, Human: P, tie Choose:
Expert Solution
Step 1 Summary

I have provided  C++  CODE  along  with  CODE  SCREENSHOT  and  OUTPUT  SCREENSHOT-----------------

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

The code doesn't work properly. for the first two inputs it computer always choose Rock. Also as soon as one user (either computer or human) win two rounds it should output the result. The code should be written wothout using arrays.

Solution
Bartleby Expert
SEE SOLUTION
Follow-up Question

The prgram should be written without using arrays. how to write it wihtout using arrays?

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Developing computer interface
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
  • SEE MORE 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