Assigned: Friday, September 13
Due: Monday, September 23, 2013 by 11:55pm
You will write a program that allows the user to play the game Rock, Paper, Scissors against the computer. This will be done using a random number generator, simple while loop, and branching statements. You must write all of your code inside of a main function, and call that main function. You are not required to use additional functions, but you may if you like.
Background
Rock, Paper, Scissors (also known by several other names, see http://en.wikipedia.org/wiki/Rock_paper_scissors) is an extremely popular hand game most often played by children. Often, it is used as a method of selection similar to flipping a coin or throwing dice to randomly select a person for some purpose.
Rules of the Game
The objective of Rock, Paper, Scissors is to defeat your opponent by selecting a weapon that defeats their choice under the following rules:
Program Specifications
This program requires you to use:
Description
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:
An example of possible dialog with the user might be (user input is in italics):
Let's play Rock, Paper, Scissors! Please select your weapon: (R) for rock, (P) for paper, (S) for scissors, or (Q) to quit: P You have chosen Paper and the computer chose Scissors. The computer has won this round. Please select your weapon: (R) for rock, (P) for paper, (S) for scissors, or (Q) to quit: S You have chosen Scissors and the computer chose Scissors. It's a tie! Please select your weapon: (R) for rock, (P) for paper, (S) for scissors, or (Q) to quit: R You have chosen Rock and the computer chose Rock. It's a tie! Please select your weapon: (R) for rock, (P) for paper, (S) for scissors, or (Q) to quit: R You have chosen Rock and the computer chose Rock. It's a tie! Please select your weapon: (R) for rock, (P) for paper, (S) for scissors, or (Q) to quit: R You have chosen Rock and the computer chose Paper. The computer has won this round. Please select your weapon: (R) for rock, (P) for paper, (S) for scissors, or (Q) to quit: P You have chosen Paper and the computer chose Rock. You win! Please select your weapon: (R) for rock, (P) for paper, (S) for scissors, or (Q) to quit: Q I'm sorry to see you go! You've proven to be a worthy adversary.Your code does not need to follow this exact script, but all the mentioned functionality should work as shown.
HINT: You should get your code to work for a single round of Rock, Paper, Scissors first. Then add the loop statement to allow the user to keep playing multiple rounds.
What to Do
Requirements
When I examine your program, it must satisfy the following requirements. The maximum point value for each requirement is shown in brackets.
Extra Credit (5 points)
You may only attempt the extra credit after your program is working correctly as described above.
To earn extra credit on this assignment, your program should remember the game history (whether the user wins, the computer wins, or
the round is tied).
At the end of the game (when the user chooses to Quit), your program should display the following: