Author | AntiDog |
Submission date | 2018-08-07 13:02:39.220410 |
Rating | 4495 |
Matches played | 262 |
Win rate | 43.89 |
Use rpsrunner.py to play unranked matches on your computer.
if input == "":
output = "P"
oponentmoves = ""
else:
r = 0
p = 0
s = 0
oponentmoves += input
for i in range(2,len(oponentmoves)):
searchsequence = oponentmoves[:i]
nextresults = input.split(searchsequence)
for res in nextresults:
if res[0] == "R":
r += 1
if res[0] == "P":
p += 1
if res[0] == "S":
s += 1
if r >= p and r >= s:
output = "P" #plays R
elif p >= s and p >= r:
output = "S" #plays P
else:
output = "R" #plays S