Author | blue-tomato |
Submission date | 2015-06-17 21:31:40.532446 |
Rating | 4202 |
Matches played | 532 |
Win rate | 40.6 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input=='':
numR = 0
numP = 0
numS = 0
elif input == 'R':
numR += 1
elif input == 'P':
numP += 1
elif input == 'S':
numS += 1
Rscore = numS - numP
Pscore = numR - numS
Sscore = numP - numR
if Rscore > Pscore and Rscore > Sscore:
output = 'R'
elif Pscore > Rscore and Pscore > Sscore:
output = 'P'
elif Sscore > Rscore and Sscore > Pscore:
output = 'S'
elif Rscore == Pscore and Pscore == Sscore:
output = random.choice(['R','P','S'])
elif Rscore == Pscore:
output = random.choice(['R','P'])
elif Rscore == Sscore:
output = random.choice(['R','S'])
else:
output = random.choice(['P','S'])