wcdc

AuthorcsDx
Submission date2019-06-05 23:19:18.040791
Rating5092
Matches played244
Win rate50.82

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)