scaled_random

Authormgd020
Submission date2019-03-14 10:22:40.096330
Rating5225
Matches played256
Win rate54.69

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
    roundCount = -1
elif input == "R":
    rockCount += 1
elif input == "P":
    paperCount += 1
elif input == "S":
    scissorsCount += 1
roundCount += 1

randomRound = int(random.random() * roundCount)

if rockCount > paperCount and rockCount > scissorsCount:
    if randomRound <= rockCount:
        output = "P"
    elif paperCount > scissorsCount and randomRound <= (rockCount + paperCount):
        output = "S"
    else:
        output = "R"
elif paperCount > scissorsCount:
    if randomRound <= paperCount:
        output = "S"
    elif rockCount > scissorsCount and randomRound <= (paperCount + rockCount):
        output = "P"
    else:
        output = "R"
else:
    if randomRound <= scissorsCount:
        output = "R"
    elif rockCount > paperCount and randomRound <= (scissorsCount + rockCount):
        output = "P"
    else:
        output = "S"