This program has been disqualified.
Author | AntiProgram |
Submission date | 2011-10-18 00:57:22.750672 |
Rating | 4996 |
Matches played | 2 |
Win rate | 50.0 |
import random
#Weighted random beat previous inputs
def weighted_choice(C, p):
x = random.random()
for elmt in range(len(C)):
if x <= p[elmt]:
return C[elmt]
x -= p[elmt]
if not input:
beat={'R':'P','P':'S','S':'R','':'R'}
output=random.choice("RPS")
history=""
AMPERSAND_SECRET_SAUCE = "SSPPRSPSPRPRPPSRRSRPPSRSRSSSSSSPPPPSRPRSRPSPRPSPRR"
else:
history+=input
L=len(history)
if AMPERSAND_SECRET_SAUCE == history:
output = 'S'
else:
p = q = range(1,L+1)
for i in range(L):
p[i]=p[i]**(0.680)
q[i]=q[i]**(0.680)
q=float(sum(q))
for i in range(L):
p[i]/=q
output=beat[weighted_choice(history,p)]