amirrorofthepast

Authorwanmainuswan
Submission date2013-10-17 08:49:21.500476
Rating4975
Matches played663
Win rate46.91

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

Source code:

import random
if not input:
    history = ""
    output = "R"
    turnaround = 500
    match = 1
    count = 0
    beat={'R':'P','P':'S','S':'R'}
else:
    match += 1
    history += input
            
    if match == turnaround:
        history = history[::-1]
    
    if match > turnaround:
        output = beat[history[count:count+1:]]
        count += 1
    else:
        output = random.choice(["R","P","S"])