Author | pyfex |
Submission date | 2011-06-17 15:28:18.775125 |
Rating | 3600 |
Matches played | 5100 |
Win rate | 36.25 |
Use rpsrunner.py to play unranked matches on your computer.
# See http://overview.cc/RockPaperScissors for more information about rock, paper, scissors
if input == "":
import random
score = {'RR': 0, 'PP': 0, 'SS': 0, 'PR': 1, 'RS': 1, 'SP': 1,'RP': -1, 'SR': -1, 'PS': -1,}
beat = {'P': 'S', 'R': 'P', 'S':'R'}
rps = ['R', 'P', 'S']
hist = {0: [], -1: [], 1:[]}
output = random.choice(rps)
else:
sc = score[output+input]
hist[sc].append(input)
output = random.choice(hist[sc])