Author | WDIFTL |
Submission date | 2011-06-09 20:33:32.387180 |
Rating | 1631 |
Matches played | 5338 |
Win rate | 14.87 |
Use rpsrunner.py to play unranked matches on your computer.
import random
game = ["R","P","S"]
if input=="":
history = list()
guess = list()
output = random.choice(game)
else:
history.append(input)
count = [history.count("R"),history.count("P"),history.count("S")]
i = -1
try:
while 1:
i = count.index(min(count), i+1)
guess.append(i)
except ValueError:
pass
output = game[(random.choice(guess)+1)%3]