# iof

 Author Anonymous Submission date 2020-02-10 13:56:06.471325 Rating 7608 Matches played 200 Win rate 75.5

Use rpsrunner.py to play unranked matches on your computer.

## Source code:

``````import random
a=lambda:random.choice("RPS")
A=27
if input=="":
B=
C=[10,20,60]
D={"R":"P","P":"S","S":"R"}
E={"R":"PPR","P":"SSP","S":"RRS"}
F=G=H=""
I=[""]*A
K=0
L={"PP":"1","PR":"2","PS":"3","RP":"4","RR":"5","RS":"6","SP":"7","SR":"8","SS":"9"}
M={"1":"PP","2":"PR","3":"PS","4":"RP","5":"RR","6":"RS","7":"SP","8":"SR","9":"SS"}
N={"PP": 0,"PR":1,"PS":-1,"RP": -1,"RR":0,"RS":1,"SP": 1,"SR":-1,"SS":0}
O=*A
output=a()
P=[output]*A
else:
if len(I)<5:Q=0
else:Q=1
for i in range(A):
if P[i]==input:S="1"
else:S="0"
I[i]=I[i][Q:5]+S
F+=output
G+=input
H+=L[input+output]
K+=1
T=min(K,B)
j=T
while j>=1 and not H[K-j:K] in H[0:K-1]:j-=1
if j>=1:k=H.rfind(H[K-j:K],0,K-1);P=G[j+k];P=D[F[j+k]]
else:P=a();P=a()
j=T
while j>=1 and not G[K-j:K] in G[0:K-1]:j-=1
if j>=1:k=G.rfind(G[K-j:K],0,K-1);P=G[j+k];P=D[F[j+k]]
else:P=a();P=a()
j=T
while j>=1 and not F[K-j:K] in F[0:K-1]:j-=1
if j>=1:k=F.rfind(F[K-j:K],0,K-1);P=G[j+k];P=D[F[j+k]]
else:P=a();P=a()

for i in range(3):
U=""
V=L[(output+input)]
for start in range(2,min(C[i],K)):
if V== H[K-start]:U+=H[K-start+1]
if(U==""):P[6+i]=a()
else:
e={"P":0,"R":0,"S":0}
for h in U:
j=M[h]
if(N[j]==-1):e[M[h]]+=3
elif(N[j]==0):e[M[h]]+=1
elif(N[j]==1):e[D[M[h]]]+=1
f=-1
g=""
for l in e:
if(e[l]>f):f=e[l];g+=l
P[6+i]=random.choice(g)
for i in range(9,27):P[i]=D[D[P[i-9]]]
d=len(I)
for i in range(A):
m=0
for j in range(d):
if I[i][j]=="1":m+=(j+1)*(j+1)
else:m-=(j+1)*(j+1)
O[i]=m
b=max(O)
if b>0:c=P[O.index(b)]
else:c=random.choice(G)
output=random.choice(E[c])``````