Author | scrub |
Submission date | 2017-12-06 16:32:06.578070 |
Rating | 3949 |
Matches played | 319 |
Win rate | 36.36 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "":
countS = countR = countP = 0
opponentMoves = []
elif input == "R":
opponentMoves += ['R']
elif input == "P":
opponentMoves += ['P']
elif input == "S":
opponentMoves += ['S']
last4 = opponentMoves[-4:]
for move in last4:
if move == 'R':
countR += 1
if move == 'P':
countP += 1
if move == 'S':
countS += 1
if countR > countP and countR > countS:
output = 'P'
elif countP > countS and countP > countR:
output = 'S'
else:
output = 'R'