&&&&&

This program has been disqualified.


Author&&&
Submission date2011-06-20 19:38:33.630858
Rating6808
Matches played2137
Win rate63.03

Source code:

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='S'
	history=""
	AMPERSAND_SECRET_SAUCE = "SSPPRSPSPRPRPPSRRSRPPSRSRSSSSSSPPPPSRPRSRPSPRPSPRR"
else:
	history+=input
	L=len(history)
	if L<50:
		output = AMPERSAND_SECRET_SAUCE[L]
	else:
		p = q = range(1,L+1)
		for i in range(L):
			p[i]*=p[i]
			q[i]*=q[i]
		q=float(sum(q))
		for i in range(L):
			p[i]/=q
		output=beat[weighted_choice(history,p)]