Author | Naturel |
Submission date | 2014-01-16 23:21:49.776589 |
Rating | 3548 |
Matches played | 633 |
Win rate | 37.76 |
Use rpsrunner.py to play unranked matches on your computer.
# Variant of LeastExpected with a similar intention to break those markov chains
import random
winner = {"R": "P", "P": "S", "S": "R"}
if not input:
mypattern = {}
mypattern["R"] = {"R": 0, "P": 0, "S": 0}
mypattern["P"] = {"R": 0, "P": 0, "S": 0}
mypattern["S"] = {"R": 0, "P": 0, "S": 0}
last = random.choice("RPS")
output = random.choice("RPS")
else:
now = mypattern[last]
output = winner[winner[max(now, key=lambda m: now[m])]]
mypattern[last][output] += 1
last = output