I need help with A Two Player Rock, Paper, Scissors Program in Python. Your prog
ID: 3710485 • Letter: I
Question
I need help with A Two Player Rock, Paper, Scissors Program in Python.
Your program must include the following:
This exact Main Menu:
See the Rules
Play against the computer
Play a two player game
Quit
This exact Weapon Menu for both one player and two player game to choose weapon:
Rock
Paper
Scissors
Return to Main Menu
The one player game should include a randomly generated choice (1 – 3) by the computer for the weapon and should calculate and display scores for the player and computer each time a game is played. The score must continue to add up if the user chooses to play multiple times.
The two-player game should calculate and display scores for the two players each time they finish a game. The score must continue to add up if the users choose to play multiple times.
The user(s) should be allowed to play as many times as he/she wishes until a choice is made to quit that game.
Required Input validation:
The user must choose 1 – 4 from the main menu.
The user must choose 1 – 4 from the weapon menu.
Paper Covers Rock
Rock Smashed Scissors
Scissors Cut Paper
I understand how to do the if, elif, else. I was able to do the computer part previously, I just need help with the Main Menu, Weapon Menu, and 2 players.
Explanation / Answer
#this program will simulate a Rock Paper Scissors game. from random import randrange def main(): #declare and initialize variables #int menuChoice = playerOneScore = playerTwoScore = 0 menuChoice = playerOneScore = playerTwoScore = 0 #int pOneChoice = pTwoChoice = cpuChoice = -1 pOneChoice = pTwoChoice = cpuChoice = -1 #Display intro print("************************************************************************") print("********************ROCK PAPER SCISSORS BATTLE ARENA********************") print("************************************************************************") while menuChoice !=4: #Display menuChoice print(" 1) See the rules") print("2) Play against the computer") print("3) Play a two player game") print("4) Quit ") #Prompt for menuChoice menuChoice = eval(input("Please enter a menu choice: ")) if menuChoice == 1: #display rules print(" *************************************************") print(" ========RULES ARE AS FOLLOW=========") print(" *************************************************") print(" Paper Covers Rock") print(" Rock smashed Scissors") print(" Scissors Cut Paper ") print("***************************************************") elif menuChoice == 2: while pOneChoice !=4: #display pOneChoice print(" ---------------------------------------") print(" BATTLE AGAINST COMPUTER") print("---------------------------------------") print(" 1) Rock") print("2) Paper") print("3) Scissors") print("4) Return to main menu ") #prompt for pOneChoice pOneChoice = eval(input("chose your weapon, or 4 to go back to main menu: ")) if pOneChoice == 1: print(" **Player One chose Rock**") elif pOneChoice == 2: print(" **Player One chose Paper**") elif pOneChoice == 3: print(" **Player One chose Scissors**") elif pOneChoice == 4: #back to main menu print(" Back to main menu.. ") else: #Display invalid print(" Please make a valid input(1-4)") #prompt for cpuChoice cpuChoice = randrange(1,4) print("**Computer has chosen**") if (pOneChoice == 1 and cpuChoice ==2): print(" ####You lose, Paper covers Rock####") elif (pOneChoice == 1 and cpuChoice == 3): print(" ####You win! Rock breaks Scissors####") elif (pOneChoice == 2 and cpuChoice == 1): print(" ####You win! Paper covers Rock####") elif (pOneChoice == 2 and cpuChoice == 3): print(" ####You lose, Scissors cuts Paper####") elif (pOneChoice == 3 and cpuChoice == 1): print(" ####You lose, Rock breaks Scissors####") elif (pOneChoice == 3 and cpuChoice == 2): print(" ####You win! Scissors cuts paper####") else: (pOneChoice == cpuChoice) print(" ####It's a draw####") elif menuChoice == 3: pOneChoice = -1 while pOneChoice !=4:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.