| Author | nk! | 
| Submission date | 2017-12-14 18:33:04.713370 | 
| Rating | 4727 | 
| Matches played | 281 | 
| Win rate | 47.69 | 
Use rpsrunner.py to play unranked matches on your computer.
#RPS Contest Project
#1 output start with random until certain number of list data
#2 function that will make a list of opponent's moves
#3 use list to predict next move based on frequency/patterns
#4 output based on 
import random
user = input
opponentMoves = ["R","P","R","S"]
last4 = opponentMoves[-4:]
def count_substring(opponentMoves, last4):
    count = 0
    for i in range(len(opponentMoves)):
        count += opponentMoves[i]==last4
    return count
if user == "":
    opponentMoves.append("")
elif user == "R":
    opponentMoves.append("R")
elif user == "P":
    opponentMoves.append("P")
elif user == "S":
    opponentMoves.append("S")
countR = count_substring(opponentMoves, last4 + ["R"])
countP = count_substring(opponentMoves, last4 + ["P"])
countS = count_substring(opponentMoves, last4 + ["S"])
if countR>countP>countS:
    output = "P"
elif countP>countR>countS:
    output = "S"
elif countS>countP>countR:
    output = "R"
elif countS == countP == countR:
    output = random.choice(["R","P","S"])