Author | scrub |
Submission date | 2017-12-08 17:23:57.730000 |
Rating | 3397 |
Matches played | 307 |
Win rate | 31.92 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "":
countS = countR = countP = 0
STR = []
elif input == "R":
STR += ['R']
elif input == "P":
STR += ['P']
elif input == "S":
STR += ['S']
last4 = STR[-4:]
last4P = last4 + ['P']
last4R = last4 + ['R']
last4S = last4 + ['S']
for i in range(len(STR)):
if (STR[i:i+5] == last4P ):
countP = countP + 1
for i in range(len(STR)):
if (STR[i:i+5] == last4R ):
countR = countR + 1
for i in range(len(STR)):
if (STR[i:i+5] == last4S ):
countS = countS + 1
if countR > countP and countR > countS:
output = 'P'
elif countP > countS and countP > countR:
output = 'S'
else:
output = 'R'