Author | Tom Theisen |
Submission date | 2011-07-06 17:42:14.245520 |
Rating | 6581 |
Matches played | 4688 |
Win rate | 67.68 |
Use rpsrunner.py to play unranked matches on your computer.
# Spry v0.1 by Tom Theisen
# Not sure if it even runs
import random
length = 4
if input == "":
current = ""
history = {}
if len(current) == length:
history[current] = history.get(current, "") + input
current = (current + input)[-length:]
if current in history:
prediction = random.choice(history[current])
output = {"R": "P", "P": "S", "S": "R"}[prediction]
else:
output = random.choice("RPS")