Author | ScienceMentorsTest |
Submission date | 2019-07-25 06:16:02.794282 |
Rating | 5393 |
Matches played | 233 |
Win rate | 52.36 |
Use rpsrunner.py to play unranked matches on your computer.
import random
import operator
pickCounter = {"R": 0, "P": 0, "S": 0}
winningMoves = {"R": "P", "P": "S", "S": "R"}
def getDictMax(dictionary):
return max(dictionary.items(), key=operator.itemgetter(1))[0]
if input is "":
output = random.choice(["R", "P", "S"])
else:
pickCounter[input] += 1
output = winningMoves[getDictMax(pickCounter)]