PropRand2

AuthorHenry Elliott
Submission date2017-07-28 05:18:56.090070
Rating5101
Matches played203
Win rate52.22

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 = "P"
    elif selection >= rock_count + 1 and selection <= rock_count + paper_count:
        output = "S"
    else:
        output = "R"