From 83547216ea51a60916f0eb3b7640ee181f4fc3b3 Mon Sep 17 00:00:00 2001 From: Dodopo2324 <73190661+Dodopo2324@users.noreply.github.com> Date: Tue, 27 Oct 2020 15:22:53 -0400 Subject: [PATCH 1/5] Update RockPaperScissors.py --- RockPaperScissors.py | 62 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/RockPaperScissors.py b/RockPaperScissors.py index b7cc796..556f147 100644 --- a/RockPaperScissors.py +++ b/RockPaperScissors.py @@ -6,7 +6,7 @@ # These are the possible choices in the game, using the randint function, the computer will be a choice based on the integer it chooses -list = ['rock', 'paper', 'scissors'] +list = ['rock', 'paper', 'scissors','lizard','spock'] # Compare var1 and computerChoice to see who wins @@ -20,6 +20,14 @@ print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') +elif computerChoice == 'rock' and var1 == 'spock'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', The computer wins!') + +elif computerChoice == 'rock' and var1 == 'lizard'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', You win!') + # The following is all the comparisons if the computer chooses "Paper" elif computerChoice == 'paper' and var1 == 'rock'): print('You chose ' + var1 + ' and the computer chose ' + @@ -28,6 +36,14 @@ elif computerChoice == 'paper' and var1 == 'scissors'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') + +elif computerChoice == 'paper' and var1 == 'lizard'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', The computer wins!') + +elif computerChoice == 'paper' and var1 == 'spock'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', You win!') # The following is all the comparisons if the computer chooses "Scissors" elif computerChoice == 'scissors' and var1 == 'paper'): @@ -37,6 +53,50 @@ elif computerChoice == 'scissors' and var1 == 'rock'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') + +elif computerChoice == 'scissors' and var1 == 'spock'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', The computer wins!') + +elif computerChoice == 'scissors' and var1 == 'lizard'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', You win!') + +#spock rules + +elif computerChoice == 'spock' and var1 == 'paper'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', The computer wins!') + +elif computerChoice == 'spock' and var1 == 'scissors'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', You win!') + +elif computerChoice == 'spock' and var1 == 'lizard'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', The computer wins!') + +elif computerChoice == 'spock' and var1 == 'rock'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', You win!') + +#Lizard rules + +elif computerChoice == 'lizard' and var1 == 'rock'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', The computer wins!') + +elif computerChoice == 'lizard' and var1 == 'spock'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', You win!') + +elif computerChoice == 'lizard' and var1 == 'scissors'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', The computer wins!') + +elif computerChoice == 'lizard' and var1 == 'paper'): + print('You chose ' + var1 + ' and the computer chose ' + + computerChoice + ', You win!') # The case in which both the computer and the user chose the same one, and they tie else: From ab20c0bd4b26af06d60ce7beef1fa2022531975c Mon Sep 17 00:00:00 2001 From: Dodopo2324 <73190661+Dodopo2324@users.noreply.github.com> Date: Tue, 27 Oct 2020 15:34:01 -0400 Subject: [PATCH 2/5] Update RockPaperScissors.py --- RockPaperScissors.py | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/RockPaperScissors.py b/RockPaperScissors.py index 556f147..b7e21fa 100644 --- a/RockPaperScissors.py +++ b/RockPaperScissors.py @@ -13,18 +13,17 @@ # The following is all the comparisons if the computer chooses "Rock" if computerChoice == 'rock' and var1 == 'scissors'): - print('You chose ' + var1 + ' and the computer chose ' + - computerChoice + ', The computer wins!') + print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') elif computerChoice == 'rock' and var1 == 'paper'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') -elif computerChoice == 'rock' and var1 == 'spock'): +elif computerChoice == 'rock' and var1 == 'lizard'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'rock' and var1 == 'lizard'): +elif computerChoice == 'rock' and var1 == 'spock'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') @@ -36,12 +35,12 @@ elif computerChoice == 'paper' and var1 == 'scissors'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') - -elif computerChoice == 'paper' and var1 == 'lizard'): + +elif computerChoice == 'paper' and var1 == 'spock'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'paper' and var1 == 'spock'): +elif computerChoice == 'paper' and var1 == 'lizard'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') @@ -53,48 +52,48 @@ elif computerChoice == 'scissors' and var1 == 'rock'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') - -elif computerChoice == 'scissors' and var1 == 'spock'): + +elif computerChoice == 'scissors' and var1 == 'lizard'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'scissors' and var1 == 'lizard'): +elif computerChoice == 'scissors' and var1 == 'spock'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') #spock rules -elif computerChoice == 'spock' and var1 == 'paper'): +elif computerChoice == 'spock' and var1 == 'scissors'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'spock' and var1 == 'scissors'): +elif computerChoice == 'spock' and var1 == 'paper'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') - -elif computerChoice == 'spock' and var1 == 'lizard'): + +elif computerChoice == 'spock' and var1 == 'rock'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'spock' and var1 == 'rock'): +elif computerChoice == 'spock' and var1 == 'lizard'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') - + #Lizard rules -elif computerChoice == 'lizard' and var1 == 'rock'): +elif computerChoice == 'lizard' and var1 == 'spock'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'lizard' and var1 == 'spock'): +elif computerChoice == 'lizard' and var1 == 'rock'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') - -elif computerChoice == 'lizard' and var1 == 'scissors'): + +elif computerChoice == 'lizard' and var1 == 'paper'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'lizard' and var1 == 'paper'): +elif computerChoice == 'lizard' and var1 == 'scissors'): print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') From 7d7c072b90e84c61737a1d18b9e88da76dd76bce Mon Sep 17 00:00:00 2001 From: Dodopo2324 <73190661+Dodopo2324@users.noreply.github.com> Date: Tue, 27 Oct 2020 15:35:20 -0400 Subject: [PATCH 3/5] Update RockPaperScissors.py From 84ed33e22855c55c2e0ce61ecfa3c9af4b6373bf Mon Sep 17 00:00:00 2001 From: Dodopo2324 <73190661+Dodopo2324@users.noreply.github.com> Date: Tue, 27 Oct 2020 15:45:42 -0400 Subject: [PATCH 4/5] Update RockPaperScissors.py --- RockPaperScissors.py | 60 ++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/RockPaperScissors.py b/RockPaperScissors.py index b7e21fa..d27bb46 100644 --- a/RockPaperScissors.py +++ b/RockPaperScissors.py @@ -3,97 +3,115 @@ # Author: FX Coding Club # Date 9/24/2020 # +## GAMEPLAY ELEMENTS CREDITS GOES FULLY TO z4ab +import random +# These are the possible choices in the game, using the randint function, the computer will be a choice based on the integer it chooses +ls = ['rock', 'scissors', 'paper','lizard','spock'] + +difficulty = 1 # chance for computer to win +var1 = input("Choose 'rock', 'paper', 'scissors', 'lizard' or 'spock'") + +# Compare var1 and computerChoice to see who wins +nls = ls.copy() +nls.remove(var1) + +computerChoice = "" +if difficulty*100 == int(random.randrange(0, 100)): + computerChoice = random.choice(nls) +else: + computerChoice = ls[ls.index(var1) - 1] +# Compare playerChoice and computerChoice to see who wins # These are the possible choices in the game, using the randint function, the computer will be a choice based on the integer it chooses -list = ['rock', 'paper', 'scissors','lizard','spock'] +ls = ['rock', 'paper', 'scissors','lizard','spock'] # Compare var1 and computerChoice to see who wins # The following is all the comparisons if the computer chooses "Rock" -if computerChoice == 'rock' and var1 == 'scissors'): +if computerChoice == 'rock' and var1 == 'scissors': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'rock' and var1 == 'paper'): +elif computerChoice == 'rock' and var1 == 'paper': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') -elif computerChoice == 'rock' and var1 == 'lizard'): +elif computerChoice == 'rock' and var1 == 'lizard': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'rock' and var1 == 'spock'): +elif computerChoice == 'rock' and var1 == 'spock': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') # The following is all the comparisons if the computer chooses "Paper" -elif computerChoice == 'paper' and var1 == 'rock'): +elif computerChoice == 'paper' and var1 == 'rock': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'paper' and var1 == 'scissors'): +elif computerChoice == 'paper' and var1 == 'scissors': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') -elif computerChoice == 'paper' and var1 == 'spock'): +elif computerChoice == 'paper' and var1 == 'spock': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'paper' and var1 == 'lizard'): +elif computerChoice == 'paper' and var1 == 'lizard': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') # The following is all the comparisons if the computer chooses "Scissors" -elif computerChoice == 'scissors' and var1 == 'paper'): +elif computerChoice == 'scissors' and var1 == 'paper': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'scissors' and var1 == 'rock'): +elif computerChoice == 'scissors' and var1 == 'rock': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') -elif computerChoice == 'scissors' and var1 == 'lizard'): +elif computerChoice == 'scissors' and var1 == 'lizard': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'scissors' and var1 == 'spock'): +elif computerChoice == 'scissors' and var1 == 'spock': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') #spock rules -elif computerChoice == 'spock' and var1 == 'scissors'): +elif computerChoice == 'spock' and var1 == 'scissors': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'spock' and var1 == 'paper'): +elif computerChoice == 'spock' and var1 == 'paper': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') -elif computerChoice == 'spock' and var1 == 'rock'): +elif computerChoice == 'spock' and var1 == 'rock': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'spock' and var1 == 'lizard'): +elif computerChoice == 'spock' and var1 == 'lizard': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') #Lizard rules -elif computerChoice == 'lizard' and var1 == 'spock'): +elif computerChoice == 'lizard' and var1 == 'spock': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'lizard' and var1 == 'rock'): +elif computerChoice == 'lizard' and var1 == 'rock': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') -elif computerChoice == 'lizard' and var1 == 'paper'): +elif computerChoice == 'lizard' and var1 == 'paper': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', The computer wins!') -elif computerChoice == 'lizard' and var1 == 'scissors'): +elif computerChoice == 'lizard' and var1 == 'scissors': print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', You win!') From 112e6dc5d7c6d2e092a464e4ab7d1061a19f336c Mon Sep 17 00:00:00 2001 From: Dodopo2324 <73190661+Dodopo2324@users.noreply.github.com> Date: Tue, 27 Oct 2020 15:46:54 -0400 Subject: [PATCH 5/5] Fully playable Fully playable, Credits to z4ab for gameplay. I did the logic code. --- RockPaperScissors.py | 1 + 1 file changed, 1 insertion(+) diff --git a/RockPaperScissors.py b/RockPaperScissors.py index d27bb46..bfefd93 100644 --- a/RockPaperScissors.py +++ b/RockPaperScissors.py @@ -119,3 +119,4 @@ else: print('You chose ' + var1 + ' and the computer chose ' + computerChoice + ', you tied!') +#did it in 16 minutes.