I wrote my rock paper scissors game for glass, but i used a recursion and not a while loop. I haven't been able to get my while loop to work at all, part of the reason i didn't put it there in the first place. Also, i have to test the input values to. Can someone help me?
import random #Imports the random modual from the library.
def main(): #First function.
x = 'true'
while x=='true':
input = raw_input('Choose 1, 2 or 3')
input = int(input)
if input != 1 or != 2 or != 3:
print 'Invalid input, exiting program'
x = 'false'
else:
PlayerChoice(input)
print 'Lets play Paper Rock Scissors!\n'
print '1 For Rock\n2 For Paper\n3 For Scissors\n4 To Quit'
number=raw_input ('What do you choose? ') #Gets users input.
pc = ComputerChoice()
PlayerChoice(number, pc)
def ComputerChoice(): #Compuers function
ComputerChoice = random.randrange(1, 4) #Computers random range.
return ComputerChoice
def PlayerChoice(number, CC): #Uses the users input & compares
number = int(number) #With the computers.
print "\n"
if CC == 1 and number == 3:
print 'Computer wins: Rock beats Scissors'
elif CC == 1 and number == 2:
print 'Player wins: Paper beats Rock'
elif CC == 2 and number == 3:
print 'Player wins: Scissors beat paper'
elif CC == 3 and number == 1:
print 'Player wins: Rock beats scissors'
elif CC == 2 and number == 1:
print 'Computer wins: Paper beats rock'
elif CC == number:
print '''Draw!''' #Trying it with 3
elif CC == 3 and number == 2:
print 'Computer wins: Scissors beats rock'
elif number == 4:
print 'Goodbye'
else:
print CC
print number
if number != 4:
print '\n'
main()
#Start of program
main()
Thank you!