Author | Pawe%u0142 |
Submission date | 2018-08-21 14:46:02.729197 |
Rating | 3876 |
Matches played | 266 |
Win rate | 37.59 |
Use rpsrunner.py to play unranked matches on your computer.
import zlib
import random
winning = {"R": "P", "P": "S", "S": "R"}
if not input:
output = random.choice(["R","P","S"])
dna = ""
else:
dna += input
options = []
for move in ["R", "P", "S"]:
options.append((len(zlib.compress(dna + move)), move))
best_opp = min(options)[1]
output = winning[best_opp]