hexv1

Authorkakben
Submission date2012-10-11 08:38:45.082468
Rating5653
Matches played799
Win rate58.57

Use rpsrunner.py to play unranked matches on your computer.

Source code:

import random

if not input:
    inputs = ""
    outputs = ""
    output = random.choice(['R','P','S'])
    beat = {'R':'P','P':'S','S':'R'}

else:
    inputs += input
    r, p = inputs.count('R'), inputs.count('P')
    s = len(inputs)
    gen = random.randint(1,s)
    if gen < r:
        output = beat['R']
    elif gen < r+p:
        output = beat['P']
    else:
        output = beat['S']

outputs += output