Author | evolvingstuff |
Submission date | 2011-06-09 20:41:01.372395 |
Rating | 5718 |
Matches played | 5089 |
Win rate | 56.26 |
Use rpsrunner.py to play unranked matches on your computer.
import random
if input == "":
count = [1.0,1.0,1.0]
else:
for i in range(len(count)):
count[i] *= 0.9
if input == "R":
count[0] += 1
elif input == "P":
count[1] += 1
elif input == "S":
count[2] += 1
if random.random() < count[0] / sum(count):
output = "P"
elif random.random() < count[1] / sum(count[1:]):
output = "S"
else:
output = "R"