Author | Test |
Submission date | 2019-01-12 00:28:17.372437 |
Rating | 3288 |
Matches played | 244 |
Win rate | 31.56 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "":
move = {"R": "P", "P": "S", "S": "R"}
counts = {"R": 0, "P": 0, "S": 0}
output = random.choice("RPS")
else:
counts[input] += 1
max_count = max(counts.values())
if counts["S"] == max_count:
pred = "S"
elif counts["P"] == max_count:
pred = "P"
else:
pred = "R"
output = "PSR"[["R", "P", "S"].index(pred)]