Author | kAworu |
Submission date | 2019-05-14 10:05:18.524158 |
Rating | 5932 |
Matches played | 245 |
Win rate | 59.18 |
Use rpsrunner.py to play unranked matches on your computer.
#!/usr/bin/env python
# A bot focused on not losing rather than winning.
import math
import random
if input == "":
r, p, s = 0, 0, 0
output = random.choice("RPS")
else:
r *= 0.92
p *= 0.92
s *= 0.92
r += 0.2 if output == "R" and input == "P" else 0
p += 0.2 if output == "P" and input == "S" else 0
s += 0.2 if output == "S" and input == "R" else 0
n = random.random() * (math.exp(r) + math.exp(p) + math.exp(s))
if n < math.exp(r):
output = random.choice("PS")
elif n < (math.exp(r) + math.exp(p)):
output = random.choice("RS")
else:
output = random.choice("RP")