Author | nk! |
Submission date | 2017-12-06 16:50:11.996850 |
Rating | 5067 |
Matches played | 318 |
Win rate | 54.09 |
Use rpsrunner.py to play unranked matches on your computer.
import random
opponentMoves=[]
output=random.choice(["R","P","S"])
if input == "":
opponentMoves = []
elif input == "R":
opponentMoves += "R"
elif input == "P":
opponentMoves += "P"
elif input == "S":
opponentMoves += "S"
def analyzeList(opponentMoves, L):
L = opponentMoves[:-4]
if L == "":
output = random.choice(["R","P","S"])
elif L in opponentMoves[0:4]:
if L[0]== "R":
output= "P"
elif L[0]== "P":
output= "S"
elif L[0]== "S":
output= "R"
elif L not in opponentMoves[4:]:
return analyzeList(opponentMoves[1:], L[1:])
if len(opponentMoves)>10:
analyzeList(opponentMoves, L)