Author | AntiDog |
Submission date | 2018-08-07 13:00:58.854600 |
Rating | 3347 |
Matches played | 272 |
Win rate | 31.62 |
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 = "R"
elif p >= s and p >= r:
output = "P"
else:
output = "S"