| Author | nk! | 
| Submission date | 2017-12-13 23:53:42.650740 | 
| Rating | 5349 | 
| Matches played | 314 | 
| Win rate | 51.91 | 
Use rpsrunner.py to play unranked matches on your computer.
import random
opponentMoves =[]
if input == "":
    opponentMoves =[]
elif input == "R":
    opponentMoves += "R"
elif input == "P":
    opponentMoves += "P"
elif input == "S":
    opponentMoves += "S"
def count_substring(opponentMoves, last4):
    count = 0
    for i in range(len(opponentMoves)-1):
        count += opponentMoves[i]==last4
    return count
last4= opponentMoves[-4:]
countR = count_substring(opponentMoves, last4)
countP = count_substring(opponentMoves, last4)
countS = count_substring(opponentMoves, last4)
if countR>countP>countS:
        output = "P"
elif countP>countR>countS:
    output = "S"
elif countS>countP>countR:
    output = "R"
else:
    output = random.choice(["R","P","S"])