less_is_good3

Authorleowu2017
Submission date2017-12-05 18:46:12.913530
Rating1802
Matches played308
Win rate16.23

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

Source code:

import random

if not input:
    his_len = 5
    beat = {'R':'P', 'P':'S', 'S':'R'}
    his = [''] * his_len
    output = random.choice("RPS")
else:
    his = his[1:] + [input]
    R_num = (his.count('R'), 'R')
    P_num = (his.count('P'), 'P')
    S_num = (his.count('S'), 'S')
    min_val = min(R_num, P_num, S_num)[0]
    min_idx = [x[1] for x in [R_num, P_num, S_num] if x[0] == min_val]
    output = beat[random.choice(min_idx)]