Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment, you will create a program that plays the game Rock, Paper, Scissors. in python Rules of the Game: The objective of Rock,

For this assignment, you will create a program that plays the game Rock, Paper, Scissors. in python

Rules of the Game:

The objective of Rock, Paper, and Scissors is to defeat your opponent by selecting a weapon that defeats their choice under the following rules:

Rock smashes (or blunts) Scissors, so Rock wins

Scissors cut Paper, so Scissors win

Paper covers Rock, so Paper wins

If players choose the same weapon, neither win and the game is played again

Program Specifications

This project requires you to use:

input to prompt the user

print to print results

at least one branching mechanism (if statement)

at least one loop (while loop)

Boolean logic

Your program will allow a human user to play Rock, Paper, Scissors with the computer. Each round of the game will have the following structure:

The program will choose a weapon (Rock, Paper, Scissors), but its choice will not be displayed until later so the user doesnt see it.

The program will announce the beginning of the round and ask the user for his/her weapon choice

The two weapons will be compared to determine the winner (or a tie) and the results will be displayed by the program

The next round will begin, and the game will continue until the user chooses to quit

The computer will keep score and print the score when the game ends

The computer should select the weapon most likely to beat the user, based on the users previous choice of weapons. For instance, if the user has selected Paper 3 times but Rock and Scissors only 1 time each, the computer should choose Scissors as the weapon most likely to beat Paper, which is the users most frequent choice so far. To accomplish this, your program must keep track of how often the user chooses each weapon. Note that you do not need to remember the order in which the weapons were used. Instead, you simply need to keep a count of how many times the user has selected each weapon (Rock, Paper or Scissors). Your program should then use this playing history (the count of how often each weapon has been selected by the user) to determine if the user currently has a preferred weapon; if so, the computer should select the weapon most likely to beat the users preferred weapon. During rounds when the user does not have a single preferred weapon, the computer may select any weapon. For instance, if the user has selected Rock and Paper 3 times each and Scissors only 1 time, or if the user has selected each of the weapons an equal number of times, then there is no single weapon that has been used most frequently by the user; in this case the computer may select any of the weapons.

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions