Attempt to lose 3

This program has been disqualified.


Authordllu
Submission date2011-09-16 21:02:24.770981
Rating805
Matches played285
Win rate8.42

Source code:

#This is a copy of DNA werfer that should lose. 

import random

number_of_predictors = 57 #yes, this really has 57 predictors.

predictors=range(number_of_predictors)

for i in range(number_of_predictors):
	predictors[i]=random.choice(['R','P','S'])

if not input:
	limits = [5,15,30]
	beat={'R':'P','P':'S','S':'R'}
	urmoves=""
	mymoves=""
	DNAmoves=""
	output=random.choice(['R','P','S'])
	predictorscore=range(number_of_predictors)
	nuclease={'RP':'a','PS':'b','SR':'c','PR':'d','SP':'e','RS':'f','RR':'g','PP':'h','SS':'i'}
	length=0
else:
	for i in range(number_of_predictors):
		predictorscore[i]*=0.8
		predictorscore[i]+=(input==oldpredictors[i])*3
		predictorscore[i]-=(input=={'R':'S', 'P':'R', 'S':'P'}[oldpredictors[i]])*3
	
	#History matching
	urmoves+=input		
	mymoves+=output
	DNAmoves+=nuclease[input+output]
	length+=1
	if not predictorscore.index(max(predictorscore)) in [54, 55, 56]:
		for z in range(3):
			limit = min([length,limits[z]])
			j=limit
			while j>=1 and not DNAmoves[length-j:length] in DNAmoves[0:length-1]:
				j-=1
			if j>=1:
				i = DNAmoves.rfind(DNAmoves[length-j:length],0,length-1) #You seem to be playing based on our moves
				predictors[0+6*z] = urmoves[j+i] #If you keep on playing like that, I'll beat you
				predictors[1+6*z] = beat[mymoves[j+i]] #If you think I'm continuing to play like that, you're wrong
			j=limit			
			while j>=1 and not urmoves[length-j:length] in urmoves[0:length-1]:
				j-=1
			if j>=1:
				i = urmoves.rfind(urmoves[length-j:length],0,length-1) #You seem to be playing based on your moves
				predictors[2+6*z] = urmoves[j+i] #If you keep on playing like that, I'll beat you
				predictors[3+6*z] = beat[mymoves[j+i]] #If you think I'm continuing to play like that, you're wrong
			j=limit
			while j>=1 and not mymoves[length-j:length] in mymoves[0:length-1]:
				j-=1
			if j>=1:
				i = mymoves.rfind(mymoves[length-j:length],0,length-1) #You seem to be playing based on my moves
				predictors[4+6*z] = urmoves[j+i] #If you keep on playing like that, I'll beat you
				predictors[5+6*z] = beat[mymoves[j+i]] #If you think I'm continuing to play like that, you're wrong
		
		for i in range(18,54):
			predictors[i]={'R':'S', 'P':'R', 'S':'P'}[predictors[i-18]] #Trying to second guess me?
	
	predictors[54] = 'R' #This should score a resounding defeat against "Always play rock"
	predictors[55] = 'P' #This should score a resounding defeat against "Always play paper"
	predictors[56] = 'S' #This should score a resounding defeat against "Always play scissors"
	
	#compare predictors
	output = predictors[predictorscore.index(max(predictorscore))]
output = {'R':'S','P':'R','S':'P'}[output] #attempt to lose
if length<30:
	output = 'R'

oldpredictors=predictors