From 605e3e4199aa23c8b6a6ce9560b89f7afb733d64 Mon Sep 17 00:00:00 2001 From: Leapedcomet <60005249+Leapedcomet@users.noreply.github.com> Date: Tue, 3 Nov 2020 18:15:07 -0500 Subject: [PATCH 1/3] Update RockPaperScissors.py --- RockPaperScissors.py | 125 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 103 insertions(+), 22 deletions(-) diff --git a/RockPaperScissors.py b/RockPaperScissors.py index b7cc796..16dfb0c 100644 --- a/RockPaperScissors.py +++ b/RockPaperScissors.py @@ -4,41 +4,122 @@ # Date 9/24/2020 # +import random as rnd # 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'] +choices = ['rock', 'paper', 'scissors', 'pistol', 'water', 'sourya'] -# Compare var1 and computerChoice to see who wins +playerChoice = str(input("Please enter your choice, choose between Rock, Paper, Scissors, Pistol, Sourya: ")).lower() + +computerChoices = rnd.choice(choices) + +# Compare playerChoice and computerChoice to see who wins # 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!') +if computerChoices == 'rock' and playerChoice == 'scissors': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', The computer wins!') + +elif computerChoices == 'rock' and playerChoice == 'paper': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', You win!') + +elif computerChoices == 'rock' and playerChoice == 'pistol': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', The computer wins!') -elif computerChoice == 'rock' and var1 == 'paper'): - print('You chose ' + var1 + ' and the computer chose ' + - computerChoice + ', You win!') +elif computerChoices == 'rock' and playerChoice == 'water': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', The player wins!') +elif computerChoices == 'rock' and playerChoice == 'sourya': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', You win! Sourya always 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 ' + - computerChoice + ', The computer wins!') +elif computerChoices == 'paper' and playerChoice == 'rock': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', The computer wins!') + +elif computerChoices == 'paper' and playerChoice == 'scissors': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', You win!') + +elif computerChoices == 'paper' and playerChoice == 'pistol': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', You win!') -elif computerChoice == 'paper' and var1 == 'scissors'): - print('You chose ' + var1 + ' and the computer chose ' + - computerChoice + ', You win!') +elif computerChoices == 'paper' and playerChoice == 'water': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', The computer wins!') +elif computerChoices == 'paper' and playerChoice == 'sourya': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', You win! Sourya always wins!') + +#---------------------------------------------------------------------------------------------------- # The following is all the comparisons if the computer chooses "Scissors" -elif computerChoice == 'scissors' and var1 == 'paper'): - print('You chose ' + var1 + ' and the computer chose ' + - computerChoice + ', The computer wins!') +elif computerChoices == 'scissors' and playerChoice == 'paper': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', The computer wins!') + +elif computerChoices == 'scissors' and playerChoice == 'rock': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', You win!') + +elif computerChoices == 'scissors' and playerChoice == 'pistol': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', You Win!') + +elif computerChoices == 'scissors' and playerChoice == 'water': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', The computer wins!') + +elif computerChoices == 'scissors' and playerChoice == 'sourya': + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', You Win! Sourya always win') + +#---------------------------------------------------------------------------------------------------- +# The following is all the comparisons if the computer chooses "Pistol" +elif computerChoices == 'pistol' and playerChoice == 'rock': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', You Win!') + +elif computerChoices == 'pistol' and playerChoice == 'paper': + print('You chose' + playerChoice + 'and the computer chose' + computerChoices + 'The Computer wins!') + +elif computerChoices == 'pistol' and playerChoice == 'scissors': + print('You chose' + playerChoice + 'and the computer chose' + computerChoices + ', The computer Wins!') + +elif computerChoices == 'pistol' and playerChoice == 'water': + print('You chose' + playerChoice + 'and the computer chose' + computerChoices + ', You Win') + +elif computerChoices == 'pistol' and playerChoice == 'sourya': + print('You chose' + playerChoice + 'and the computer chose' + computerChoices + ', You Win! Sourya always wins') + +#---------------------------------------------------------------------------------------------------- +#The following is all the comparisons if the computer chooses "Water" + +elif computerChoices == 'water' and playerChoice == 'rock': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + +elif computerChoices == 'water' and playerChoice == 'paper': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', You Win!') + +elif computerChoices == 'water' and playerChoice == 'scissors': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + +elif computerChoices == 'water' and playerChoice == 'rock': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + +elif computerChoices == 'water' and playerChoice == 'sourya': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', You Win! Sourya always wins!') + +#---------------------------------------------------------------------------------------------------- +#The following us all the comparisons if the computer chooses "Sourya" + +elif computerChoices == 'sourya' and playerChoice == 'rock': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + +elif computerChoices == 'sourya' and playerChoice == 'paper': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + +elif computerChoices == 'sourya' and playerChoice == 'scissors': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + +elif computerChoices == 'sourya' and playerChoice == 'pistol': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') -elif computerChoice == 'scissors' and var1 == 'rock'): - print('You chose ' + var1 + ' and the computer chose ' + - computerChoice + ', You win!') +elif computerChoices == 'sourya' and playerChoice == 'water': + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') +#---------------------------------------------------------------------------------------------------- # The case in which both the computer and the user chose the same one, and they tie else: - print('You chose ' + var1 + ' and the computer chose ' + - computerChoice + ', you tied!') + print('You chose ' + playerChoice + ' and the computer chose ' + computerChoices + ', you tied!') From 276bd79278471a9ae5009fad1eb2f33955206a88 Mon Sep 17 00:00:00 2001 From: Leapedcomet <60005249+Leapedcomet@users.noreply.github.com> Date: Tue, 3 Nov 2020 18:22:18 -0500 Subject: [PATCH 2/3] Update RockPaperScissors.py --- RockPaperScissors.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/RockPaperScissors.py b/RockPaperScissors.py index 16dfb0c..7b5de82 100644 --- a/RockPaperScissors.py +++ b/RockPaperScissors.py @@ -1,18 +1,26 @@ ## # -# Author: FX Coding Club -# Date 9/24/2020 -# +# Author: FX Coding Club, Ethan Bhalla +# Date 11/03/2020 +#Description: This code import random as rnd # These are the possible choices in the game, using the randint function, the computer will be a choice based on the integer it chooses choices = ['rock', 'paper', 'scissors', 'pistol', 'water', 'sourya'] +playerChoice = ' ' +computerChoices = rnd.choice(choices) -playerChoice = str(input("Please enter your choice, choose between Rock, Paper, Scissors, Pistol, Sourya: ")).lower() +validatePlayerChoice = False -computerChoices = rnd.choice(choices) + +while not validatePlayerChoice: + playerChoice = str(input("Please enter your choice, choose between Rock, Paper, Scissors, Pistol, Sourya: ")).lower() + if playerChoice in choices: + validatePlayerChoice = True + else: + print("Please try again, make sure you spell everything correctly") # Compare playerChoice and computerChoice to see who wins @@ -105,19 +113,19 @@ #The following us all the comparisons if the computer chooses "Sourya" elif computerChoices == 'sourya' and playerChoice == 'rock': - print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins! Sourya always wins') elif computerChoices == 'sourya' and playerChoice == 'paper': - print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins! Sourya always wins') elif computerChoices == 'sourya' and playerChoice == 'scissors': - print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins! Sourya always wins') elif computerChoices == 'sourya' and playerChoice == 'pistol': - print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins! Sourya always wins') elif computerChoices == 'sourya' and playerChoice == 'water': - print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins!') + print('You chose' + playerChoice + ' and the computer chose' + computerChoices + ', The computer wins! Sourya always wins') #---------------------------------------------------------------------------------------------------- # The case in which both the computer and the user chose the same one, and they tie From 1ee9b9f27d2c0fd9e51b343bf4ea9c30e7779c64 Mon Sep 17 00:00:00 2001 From: Leapedcomet <60005249+Leapedcomet@users.noreply.github.com> Date: Tue, 3 Nov 2020 18:40:05 -0500 Subject: [PATCH 3/3] Update RockPaperScissors.py --- RockPaperScissors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RockPaperScissors.py b/RockPaperScissors.py index 7b5de82..1b7dd9b 100644 --- a/RockPaperScissors.py +++ b/RockPaperScissors.py @@ -2,7 +2,7 @@ # # Author: FX Coding Club, Ethan Bhalla # Date 11/03/2020 -#Description: This code +# Description: This code is an updated and skewed version of rock, paper, scissors!! import random as rnd @@ -14,7 +14,7 @@ validatePlayerChoice = False - +#Input validation to make sure there are no user errors when inputting a choice while not validatePlayerChoice: playerChoice = str(input("Please enter your choice, choose between Rock, Paper, Scissors, Pistol, Sourya: ")).lower() if playerChoice in choices: