PropRand

AuthorHenry Elliott
Submission date2017-07-28 05:13:03.589710
Rating4155
Matches played206
Win rate41.26

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

Source code:

import random

if input == "":
    sys_rand = random.SystemRandom()
    rock_count = paper_count = scissor_count = 0
elif input == "R":
    rock_count += 1
elif input == "P":
    paper_count += 1
elif input == "S":
    scissor_count += 1

if input == "":
    output = sys_rand.choice(["R", "P", "S"])
else:
    selection = sys_rand.randint(1, rock_count + paper_count + scissor_count)
    if selection >= 1 and selection <= rock_count:
        output = "R"
    elif selection >= rock_count + 1 and selection <= rock_count + paper_count:
        output = "P"
    else:
        output = "S"