Author | oezi |
Submission date | 2012-10-16 09:06:09.076025 |
Rating | 5742 |
Matches played | 768 |
Win rate | 59.64 |
Use rpsrunner.py to play unranked matches on your computer.
# my first attempt for the RPScontest, and the first time every using python
# trying to return a weighted random choice based on the history
import random
if input == "":
r = p = s = 10
elif input == "R":
r += 1
elif input == "P":
p += 1
elif input == "S":
s += 1
ra = ["R"] * s
pa = ["P"] * r
sa = ["S"] * p
if input == "":
output = random.choice(["R","P","S"])
else:
output = random.choice(ra + pa + sa)