I have this program that i have been working on
which plays rock paper scissors game with the user.
'''play a game of Rock, Paper, Scissors'''
from random import randint
def firstChooserWins( chooserChoice, otherChoice ):
#print chooserChoice, otherChoice
if (chooserChoice == "Rock" and otherChoice == "Scissors") or \
(chooserChoice == "Paper" and otherChoice == "Rock") or \
(chooserChoice == "Scissors" and otherChoice == "Paper"):
return True
else:
return False
def playGame():
choice = { 1:"Rock", 2:"Paper", 3:"Scissors" }
while True:
playerPick = int(raw_input("""
Enter choice:
0 : Quit
1 : Rock
2 : Paper
3 : Scissors
Your choice : """))
if playerPick == 0:
break
if playerPick not in choice.keys():
print "Invalid choice"
continue
playerChoice = choice[playerPick]
computerChoice = choice[randint(1,3)]
print "You chose %s, the computer chose %s" % ( playerChoice, computerChoice )
if firstChooserWins( playerChoice, computerChoice ):
print "You win!"
else:
print "You lose!"
print "Bye!"
def main():
playGame()
main()
but i need to modify it to so it contains a "best of x" loop
then for it to stop as soon as the user or the COM has won
Everytime i think i have the right logic or statements it either crashes or doesnt work correctly
Any suggestions??