Author | iggi |
Submission date | 2019-02-04 19:57:33.458135 |
Rating | 3294 |
Matches played | 256 |
Win rate | 29.69 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if not input:
moves = ["R", "P", "S"]
beatenBy = {"R": "P", "P": "S", "S": "R"}
lPlayed = random.choice(moves)
output = lPlayed
else:
lReceived = input
if lReceived == beatenBy.get(lPlayed, None):
output = beatenBy.get(lReceived, None)
else:
output = lPlayed