Author | pyfex |
Submission date | 2011-07-07 18:28:43.212469 |
Rating | 6137 |
Matches played | 4395 |
Win rate | 57.13 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "":
rps = ['R', 'P', 'S']
beat = {'R': 'P', 'P': 'S', 'S': 'R'}
output = random.choice(rps)
else:
probs = [0.95, 0.95, 0.95]
probs[rps.index(input)] += 0.05
probs[rps.index(beat[output])] += 0.05
vals = map(lambda x: random.uniform(0, x), probs)
output = beat[rps[vals.index(max(vals))]]