Author | AntiDog |
Submission date | 2018-08-07 13:46:30.517820 |
Rating | 2626 |
Matches played | 272 |
Win rate | 24.26 |
Use rpsrunner.py to play unranked matches on your computer.
oponentmoves = "RPSRPSRPSRPSRPS"
r = 0
p = 0
s = 0
for i in range(1,len(oponentmoves)):
searchsequence = oponentmoves[len(oponentmoves)-i:]
nextresults = oponentmoves.split(searchsequence)
print searchsequence,nextresults
for res in nextresults:
if res == "":
res = searchsequence
if res[0] == "R":
r += 1
elif res[0] == "P":
p += 1
elif res[0] == "S":
s += 1
else:
continue
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
print(output, r,s,p)