Python: You must make a rock paper scissors game Goal Ask the player if they pick rock paper or scissors ask for r, p, or s or 1, 2, or 3.   Have the computer chose its move Compare the choices and decide who wins Print the results Sub-goals Let the playe

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

Python:

You must make a rock paper scissors game

Goal

  • Ask the player if they pick rock paper or scissors

    • ask for r, p, or s or 1, 2, or 3.  
  • Have the computer chose its move

  • Compare the choices and decide who wins

  • Print the results

Sub-goals

  • Let the player play again

  • Keep a record of the score e.g. (Player: 3 / Computer: 6)

  • Keep a record of the games played (2 dimensional array)
  • Use a  Functions for:
    • Comparing player choices
    • Error trap for choice
You must make a rock paper scissors game

**Goal**

- Ask the player if they pick rock, paper, or scissors
  - ask for r, p, or s or 1, 2, or 3.
- Have the computer choose its move
- Compare the choices and decide who wins
- Print the results

**Sub-goals**

- Let the player play again
- Keep a record of the score e.g. (Player: 3 / Computer: 6)
- Keep a record of the games played (2-dimensional array)
- Use a Functions for:
  - Comparing player choices
  - Error trap for choice

**Diagram Explanation**

The diagram is a circular representation of the rules of rock-paper-scissors:

- **Rock** (represented by a fist) beats **scissors** (represented by two fingers in a cutting motion).
- **Scissors** (represented by two fingers) beat **paper** (represented by a flat hand).
- **Paper** (represented by a flat hand) beats **rock** (represented by a fist).

Arrows indicate the direction of which choice wins over the other, reinforcing the cyclical nature of the game.
Transcribed Image Text:You must make a rock paper scissors game **Goal** - Ask the player if they pick rock, paper, or scissors - ask for r, p, or s or 1, 2, or 3. - Have the computer choose its move - Compare the choices and decide who wins - Print the results **Sub-goals** - Let the player play again - Keep a record of the score e.g. (Player: 3 / Computer: 6) - Keep a record of the games played (2-dimensional array) - Use a Functions for: - Comparing player choices - Error trap for choice **Diagram Explanation** The diagram is a circular representation of the rules of rock-paper-scissors: - **Rock** (represented by a fist) beats **scissors** (represented by two fingers in a cutting motion). - **Scissors** (represented by two fingers) beat **paper** (represented by a flat hand). - **Paper** (represented by a flat hand) beats **rock** (represented by a fist). Arrows indicate the direction of which choice wins over the other, reinforcing the cyclical nature of the game.
**Rock, Paper, Scissors Game Functional Specifications**

**Criteria**

1. **Have computer randomly choose a move**: The computer should be programmed to select a move from "rock," "paper," or "scissors" at random to simulate an opponent's move.

2. **Compare choice with a function**: Implement a function that compares the player's choice and the computer's choice to determine the winner of each round.

3. **Allow player to play again**: After each round, the program should prompt the player with an option to play another round.

4. **Keeps score of wins and losses using counters**: The program should maintain a count of how many games the player has won and lost.

5. **Keeps a record of games played using a 2-dimensional array**: Store each game's data in a 2D array to track moves and outcomes over multiple rounds.

6. **Error Traps for choice**: Include input validation to catch any invalid entries and prompt the user to make a correct selection (rock, paper, or scissors).

7. **Prints score and games played upon exiting**: When the player chooses to exit the game, the program should display the final scores and a summary of all games played.

8. **Program runs and results properly**: Ensure the game program operates without errors and accurately calculates and displays results throughout the gameplay.

The game is designed to be a simple yet educational project that can help learners understand fundamental programming concepts, including randomization, function usage, loop structures, arrays, and input validation.
Transcribed Image Text:**Rock, Paper, Scissors Game Functional Specifications** **Criteria** 1. **Have computer randomly choose a move**: The computer should be programmed to select a move from "rock," "paper," or "scissors" at random to simulate an opponent's move. 2. **Compare choice with a function**: Implement a function that compares the player's choice and the computer's choice to determine the winner of each round. 3. **Allow player to play again**: After each round, the program should prompt the player with an option to play another round. 4. **Keeps score of wins and losses using counters**: The program should maintain a count of how many games the player has won and lost. 5. **Keeps a record of games played using a 2-dimensional array**: Store each game's data in a 2D array to track moves and outcomes over multiple rounds. 6. **Error Traps for choice**: Include input validation to catch any invalid entries and prompt the user to make a correct selection (rock, paper, or scissors). 7. **Prints score and games played upon exiting**: When the player chooses to exit the game, the program should display the final scores and a summary of all games played. 8. **Program runs and results properly**: Ensure the game program operates without errors and accurately calculates and displays results throughout the gameplay. The game is designed to be a simple yet educational project that can help learners understand fundamental programming concepts, including randomization, function usage, loop structures, arrays, and input validation.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Concept of Parenthesis
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