Question: For this program you will be building a Python version of the game Rock Paper Scissors Lizard Spock which was popularized by the TV show
For this program you will be building a Python version of the game "Rock Paper Scissors Lizard Spock" which was popularized by the TV show "The Big Bang Theory"
In this game the two players will select from one of 5 different choices - Rock, Paper, Scissors, Lizard or Spock. Each choice has the ability to win over two other choices. For example, Paper covers Rock, and Paper also "disproves" Spock. Each choice is also vulnerable against two other choices. For example, Scissors cuts Paper, and Lizard eats Paper. All of the possible combinations for the game can be seen in this diagram, and are reprinted in text form below:
Scissors cuts Paper
Paper covers Rock
Rock crushes Lizard
Lizard poisons Spock
Spock smashes Scissors
Scissors decapitates Lizard
Lizard eats paper
Paper disproves Spock
Spock vaporizes Rock
Rock crushes Scissors
Your task is to build a fully functional version of this game that allows the user to play a "tournament" of games against the computer. The user will indicate how many wins will be necessary to win the tournament at the beginning of the program. You can assume that that the user will enter integers when prompted. Your program must validate that the number of wins is greater than 0.
Next, the game will continually let the user know the overall score and will prompt them to enter in one of the possible moves (Rock, Paper, Scissors, Lizard or Spock) - if the user supplies an invalid move the program should alert them and then re-iterate, ignoring the incorrect command and resetting the current round.
Finally, the computer should randomly select a move and the moves should be evaluated against one another. The game should "announce" the move using the descriptions presented in the graphic above (i.e. "Lizard eats Paper"). The game should keep track how many rounds have been played, which player wins each round, along with how many "ties" have been detected in the game. When the desired # of wins has been reached the program should end. At that point you should display a summary of the moves played by each player. Here's a sample running of the program:
Let's Play Rock, Paper, Scissors, Lizard, Spock! How many wins is required to end the tournament? 0 Invalid, try again How many wins is required to end the tournament? 3 OK, here we go ------------------------------------- Round #1 You have won 0 rounds The computer has won 0 rounds There have been 0 ties so far ------------------------------------- (R)ock, (P)aper, (S)cissors, (L)izard or Sp(O)ck: pikachu This is an invalid choice, please try again. ------------------------------------- Round #1 You have won 0 rounds The computer has won 0 rounds There have been 0 ties so far ------------------------------------- (R)ock, (P)aper, (S)cissors, (L)izard or Sp(O)ck: AARDVARK This is an invalid choice, please try again. ------------------------------------- Round #1 You have won 0 rounds The computer has won 0 rounds There have been 0 ties so far ------------------------------------- (R)ock, (P)aper, (S)cissors, (L)izard or Sp(O)ck: r The computer has selected Spock Spock vaporizes Rock! Computer wins! ------------------------------------- Round #2 You have won 0 rounds The computer has won 1 rounds There have been 0 ties so far ------------------------------------- (R)ock, (P)aper, (S)cissors, (L)izard or Sp(O)ck: P The computer has selected Spock Paper disproves Spock! User wins! ------------------------------------- Round #3 You have won 1 rounds The computer has won 1 rounds There have been 0 ties so far ------------------------------------- (R)ock, (P)aper, (S)cissors, (L)izard or Sp(O)ck: S The computer has selected Scissors The round has ended in a tie! No points awarded! ------------------------------------- Round #4 You have won 1 rounds The computer has won 1 rounds There have been 1 ties so far ------------------------------------- (R)ock, (P)aper, (S)cissors, (L)izard or Sp(O)ck: O The computer has selected Scissors Spock smashes Scissors! User wins! ------------------------------------- Round #5 You have won 2 rounds The computer has won 1 rounds There have been 1 ties so far ------------------------------------- (R)ock, (P)aper, (S)cissors, (L)izard or Sp(O)ck: r The computer has selected Scissors Rock crushes Scissors! User wins! User wins the game! Game summary: - Rock was played 2 time(s) (User=2; Computer=0) - Paper was played 1 time(s) (User=1; Computer=0) - Scissors was played 4 time(s) (User=1; Computer=3) - Lizard was played 0 time(s) (User=0; Computer=0) - Spock was played 3 time(s) (User=1; Computer=2)
Here are some hints on your program:
Get the game to work one time before adding a loop to control the overall tournament.
Ensure that the user's input is case insensitive (i.e. "R" and "r" both count for "Rock")
Don't place any loops inside of other loops - that isn't required for this question.
This most likely won't be a short program. Make sure you make good use out of if / elif / else and nested statements to control the flow of your program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
