MK2

Authoriggi
Submission date2019-02-04 20:01:50.410320
Rating3930
Matches played251
Win rate35.46

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

Source code:

import random

if not input:
    moves = ["R", "P", "S"] # possible outputs
    beatenBy = {"R": "P", "P": "S", "S": "R"} # list of outcomes with string index

    lPlayed = random.choice(moves) #first play is random
    output = lPlayed
else:
    lReceived = input
    if lReceived == beatenBy.get(lPlayed, None):
        lPlayed = beatenBy.get(lReceived, None) # if previous play lost switch to the play that would win the previous play
    output = lPlayed