The difference of this program from other rock-paper-scissors from is that this program ask the computer the select the weapon most likely to beat the user,based on the user's previous choice of weapons instead of using random function.
#This is a program that will allow the user to play Rock, Paper,Scissors with the computer. #• The program will choose a weapon (Rock, Paper, Scissors),but its choice will not be displayed until later so the user doesn’t see it. #• The program will announce the beginning of the round and ask the user for his/her weapon choice. #• The two weapons will be compared to determine the winner (or a tie) and the results will be displayed by the program. #• The next round will begin, and the game will continue until the user chooses to quit. #• The computer will keep score and print the score when the game ends rock=1 paper=2 scissors=3 computer_wins=0 user_wins=0 ties=0 r=0 p=0 s=0 a=0 b=0 c=0 def RPS(): print 'Press q at any time to quit' user='' while user!='q': user=raw_input("Please choose rock(r), paper(p), or scissors(s):") print"Your choose is",user.lower() if user=='q': print "Thanks for playing!" break if user.lower() not in ['r', 'p', 's']: print "incorrect letter entered" def get_score(computer,user): if computer==r and user==p: score="user_wins" print("paper covers rock,user wins") user_wins=user_wins+1 b=b+1 return user_wins elif computer==r and user==s: score="computer_wins" print("scissors cut paper,computer wins") computer_wins=computer_wins+1 c=c+1 return computer_wins elif computer == p and user== r: score = 'computer_wins' print('Paper covers Rock, Computer Wins') computer_wins += 1 a=a+1 return computer_wins elif computer == p and user== s: score = 'user_wins' print('Scissors cut Paper, Player Wins') user_wins=user_wins+1 c=c+1 return user_wins elif computer == s and user== r: score = 'user_wins' print('Rock smashes Scissors, Player Wins') user_wins=user_wins+1 a=a+1 return user_wins elif computer == s and user== p: score = 'computer_wins' print('Scissors cut Paper, Computer Wins') computer_wins=computer_wins+1 b=b+1 return computer_wins elif computer==r and user==r: score="ties" print "ties",ties ties=ties+1 a=a+1 return ties elif computer==p and user==p: score="ties" print "ties",ties ties=ties+1 b=b+1 return ties elif computer==s and user==s: score="ties" print "ties",ties ties=ties+1 c=c+1 return ties def compare(a,b,c): while a>b and a>c: computer=p while b>a and b>c: computer=s while c>a and c>b: computer=r while b==a and a==c: computer=r