Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 91 additions & 18 deletions RockPaperScissors.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,117 @@
##
#
# Author: FX Coding Club
# Date 9/24/2020
# Author: VishGit1234
# Date 11/2/2020
#

import random
from random import randint

# 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', 'spock', 'lizard']

# Assign a random valid choice to computerChoice (computer answer)
computerChoice = list[randint(0, 4)]

# Get user input and store
isValid = False
while isValid == False:
print('Input one of the following; rock, paper, scissors, spock or lizard')
Choice = input()
Choice = Choice.lower()
for i in list:
if Choice == i:
isValid = True
if isValid == False:
print(Choice + ' is an incorrect input')

# Compare var1 and computerChoice to see who wins
# Compare Choice 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 ' +
if computerChoice == 'rock' and Choice == 'scissors':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', The computer wins!')

elif computerChoice == 'rock' and var1 == 'paper'):
print('You chose ' + var1 + ' and the computer chose ' +
elif computerChoice == 'rock' and Choice == 'paper':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', You win!')

elif computerChoice == 'rock' and Choice == 'spock':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', You win!')

elif computerChoice == 'rock' and Choice == 'lizard':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', The computer wins!')

# 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 ' +
elif computerChoice == 'paper' and Choice == 'rock':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', The computer wins!')

elif computerChoice == 'paper' and var1 == 'scissors'):
print('You chose ' + var1 + ' and the computer chose ' +
elif computerChoice == 'paper' and Choice == 'scissors':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', You win!')

elif computerChoice == 'paper' and Choice == 'spock':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', The computer wins!')

elif computerChoice == 'paper' and Choice == 'lizard':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', You win!')

# 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 ' +
elif computerChoice == 'scissors' and Choice == 'paper':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', The computer wins!')

elif computerChoice == 'scissors' and Choice == 'rock':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', You win!')

elif computerChoice == 'scissors' and Choice == 'spock':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', You win!')

elif computerChoice == 'scissors' and Choice == 'lizard':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', The computer wins!')

elif computerChoice == 'scissors' and var1 == 'rock'):
print('You chose ' + var1 + ' and the computer chose ' +
# The following is all the comparisons if the computer chooses "Spock"
elif computerChoice == 'spock' and Choice == 'paper':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', You win!')

elif computerChoice == 'spock' and Choice == 'rock':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', The computer wins!')

elif computerChoice == 'spock' and Choice == 'scissors':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', The computer wins!')

elif computerChoice == 'spock' and Choice == 'lizard':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', You win!')

# The following is all the comparisons if the computer chooses "Lizard"
elif computerChoice == 'lizard' and Choice == 'paper':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', The computer wins!')

elif computerChoice == 'lizard' and Choice == 'rock':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', You win!')

elif computerChoice == 'lizard' and Choice == 'scissors':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', You win!')

elif computerChoice == 'lizard' and Choice == 'spock':
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', 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 ' +
print('You chose ' + Choice + ' and the computer chose ' +
computerChoice + ', you tied!')