Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rock-Paper-Scissors-Spock-Lizard programming game with Python 3 To practice chained if-elif-else constructs. Degree of Difficulty Easy The game rock-paper-scissors-lizard-spock is an extension of the commonly known

Rock-Paper-Scissors-Spock-Lizard programming game with Python 3 image text in transcribed
To practice chained if-elif-else constructs. Degree of Difficulty Easy The game "rock-paper-scissors-lizard-spock" is an extension of the commonly known game "rock-paper scissors": If you're not familiar with rock-paper-scissors, click here. Rock-paper-scissors-lizard-spock adds two additional moves to the basic game. The rules are summarized both in this educational video (click to and the image below. The arrows indicate which move beats which. For example. the arrow from paper to Spock indicates that paper disproves Spock (if one player plays paper, and the other plays Spock, the one that played paper wins) There are 10 possible pairs of moves, so sometimes it's hard to remember them. You will write a computer program that will act as a referee. The program will accept the moves made by the two players via console input and report, which player won. To solve this problem. we'll separate the console input and output from the task of determining who won by writing a function that accepts the two moves made by the players s parameters, and returns the winner. The main program will perform the console input, call the function to determine the winner, and output the result to the console. Note that the computer is not one of the players, the computer only determines who won given the moves that the two human players made. Here's what you should do Write a function called rock_paper_scissors_lizard_spock that has two parameters. These arguments for these parameters must be one of the following five strings: 'rock' 'Paper' 'scissors' 'lizard' 'spock'. The first parameter is the move made by player 1. the second is the move made by player 2. The function must determine which player won, and return the integer 1 if player 1 was victorious, and return the integer 2 if player 2 was victorious, If the game was a tie (both players made the same move then return the integer O, You'll need to use conditionals (if. elif, else) to determine which player wins. Write an appropriate docstring for your function in part (a) In the main program after the function definition) write code to prompt for, and read the players moves from the console. You may assume that the user always enters one of the five strings listed in part (a) that indicate legal moves Pass the players' moves to the rock-paper-scissors function and obtain its return value. Use the return value to print a message to the console indicating which player won, or whether it was a tie. You'll need to use conditionals to determine what message to print out

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago