This program has been disqualified.
Author | dllu |
Submission date | 2011-06-13 19:13:54.509007 |
Rating | 7550 |
Matches played | 2155 |
Win rate | 71.18 |
#DNA Polymerase
#This enzyme helps with DNA replication.
import random
if not input:
limit = 50
telomere = 21
DNA_strand1=""
DNA_strand2=output = random.choice(['R','P','S'])
DNA_strand3="" #Unlike most other DNA, this one has three strands
base_pairs = ['R','R','R','R','S','S','S','S','R','R','R','R','S','S','S','S','R','R','R','R','R']
nucleotide_frequency = range(telomere,0,-1)
helicase=[0,0,0,0,0,0]
deoxyribonuclease = {'RP':'1','PS':'2','SR':'3','PR':'4','SP':'5','RS':'6','RR':'7','PP':'8','SS':'9'}
else:
for i in range(telomere):
nucleotide_frequency[i]*=0.8
if input==mRNA[i]:
nucleotide_frequency[i]+=telomere*0.1
elif input=={'R':'S', 'P':'R', 'S':'P'}[mRNA[i]]:
nucleotide_frequency[i]-=telomere*0.09
else:
nucleotide_frequency[i]-=telomere*0.01
j=limit
DNA_strand1+=input
DNA_strand3+=deoxyribonuclease[input+output]
length = len(DNA_strand2)
i = DNA_strand2.rfind(DNA_strand2[length-j:length-1],0,length-2)
while i==-1:
j-=1
i = DNA_strand2.rfind(DNA_strand2[length-j:length-1],0,length-2)
if j<2:
break
if i==-1 or j+i>=length:
base_pairs[0] = base_pairs[2] = random.choice(['R','P','S'])
else:
base_pairs[0] = DNA_strand1[j+i]
base_pairs[1] = {'R':'P','P':'S','S':'R'}[DNA_strand2[j+i]]
j=limit
i = DNA_strand1.rfind(DNA_strand1[length-j:length-1],0,length-2)
while i==-1:
j-=1
i = DNA_strand1.rfind(DNA_strand1[length-j:length-1],0,length-2)
if j<2:
break
if i==-1 or j+i>=length:
base_pairs[2] = base_pairs[3] = random.choice(['R','P','S'])
else:
base_pairs[2] = DNA_strand1[j+i]
base_pairs[3] = {'R':'P','P':'S','S':'R'}[DNA_strand2[j+i]]
j=limit
i = DNA_strand3.rfind(DNA_strand3[length-j:length-1],0,length-2)
while i==-1:
j-=1
i = DNA_strand3.rfind(DNA_strand3[length-j:length-1],0,length-2)
if j<2:
break
if i==-1 or j+i>=length:
base_pairs[4] = base_pairs[5] = random.choice(['R','P','S'])
else:
base_pairs[4] = DNA_strand1[j+i]
base_pairs[5] = {'R':'P','P':'S','S':'R'}[DNA_strand2[j+i]]
for i in range(6,18):
base_pairs[i] = {'R':'S','P':'R','S':'P'}[base_pairs[i-6]]
base_pairs[20] = random.choice(['R','P','S'])
#Helicase
helicase[0] = helicase[0]*0.95+{'R':0,'P':-0.1,'S':0.1}[DNA_strand2[length-1]]
helicase[1] = helicase[1]*0.95+{'R':0.1,'P':0,'S':-0.1}[DNA_strand2[length-1]]
helicase[2] = helicase[2]*0.95+{'R':-0.1,'P':0.1,'S':0}[DNA_strand2[length-1]]
base_pairs[18] = {0:'R',1:'P',2:'S',3:'R',4:'P',5:'S'}[helicase.index(max(helicase[0:3]))]
helicase[3] = helicase[3]*0.95+{'R':0.1,'P':0,'S':-0.1}[input]
helicase[4] = helicase[4]*0.95+{'R':-0.1,'P':0.1,'S':0}[input]
helicase[5] = helicase[5]*0.95+{'R':0,'P':-0.1,'S':0.1}[input]
base_pairs[19] = {0:'R',1:'P',2:'S',3:'R',4:'P',5:'S'}[helicase.index(max(helicase[3:6]))]
output = {'R':'P', 'P':'S', 'S':'R'}[base_pairs[nucleotide_frequency.index(max(nucleotide_frequency))]]
output = {0:output,1:random.choice(['R','P','S'])}[length%16==11]
DNA_strand2+=output
mRNA = base_pairs