Author | Tom |
Submission date | 2019-12-09 03:10:23.972191 |
Rating | 4492 |
Matches played | 210 |
Win rate | 47.14 |
Use rpsrunner.py to play unranked matches on your computer.
import zlib
import random
if input == "": # initialize variables for the first round
history = ""
else:
history += input
r = len(zlib.compress(input + 'RP',9))
p = len(zlib.compress(input + 'PS',9))
s = len(zlib.compress(input + 'SR',9))
possible=[]
if r == max(r,p,s): possible.append('R')
if p == max(r,p,s): possible.append('P')
if s == max(r,p,s): possible.append('S')
output = random.choice(possible)