xsd

Authorcsd
Submission date2019-06-06 06:07:27.096457
Rating4329
Matches played238
Win rate46.64

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

Source code:

import random

if input == "": # initialize variables for the first round
    rockCount = paperCount = scissorsCount = 0
elif input == "R":
    rockCount += 1
elif input == "P":
    paperCount += 1
elif input == "S":
    scissorsCount += 1

if rockCount > paperCount and rockCount > scissorsCount:
    # rock is most common
    if paperCount > scissorsCount:
        choices = "PPPSSR"
    else:
        choices = "PPPRRS"
elif paperCount > scissorsCount:
    # paper is most common
    if rockCount > scissorsCount:
        choices = "SSSPPR"
    else:
        choices = "SSSRRP"
else:
    # scissors is most common
    if rockCount > paperCount:
        choices = "RRRPPS"
    else:
        choices = "RRRSSP"

output = random.choice(choices)