Author | bleh |
Submission date | 2017-05-17 12:11:04.720570 |
Rating | 4399 |
Matches played | 377 |
Win rate | 41.38 |
Use rpsrunner.py to play unranked matches on your computer.
import random
counters = { "R" : "P", "P" : "S", "S" : "R"}
if input == "":
movehist = []
output = random.choice(['R','P','S'])
else:
movehist.append(input)
counts = { "R" : 0, "P" : 0, "S": 0 }
for rps in movehist:
counts[input] += 1
maxmov = ""
maxc = 0
for move in counts:
if counts[move] >= maxc:
maxmov = move
maxc = counts[move]
output = counters[maxmov]