RNA Polymerase VI

This program has been disqualified.


Authordllu
Submission date2011-05-27 03:58:43.211878
Rating6852
Matches played4379
Win rate69.08

Source code:

#RNA Polymerase
#This enzyme helps with RNA replication, so that the two resultant strands
#are RNA_strand1 and RNA_strand2 respectively.
import random
if not input:
	RNA_strand1=""
	RNA_strand2=""
	RNA_strand3=""
	output = random.choice(['R','P','S'])
	ribonuclease = {'RP':'I','PS':'A','SR':'M','PR':'S','SP':'U','RS':'P','RR':'E','PP':'R','SS':'B'}
	nucleotides = ['R','R','R','R','R','R','R']
	nucleic_acid = [0,0,0,0,0,0,0]
else:
	for i in range(7):
		nucleic_acid[i] *= 0.95
		nucleic_acid[i] += (4 + {'R':0,'P':1,'S':2}[nucleotides[i]] - {'R':0,'P':1,'S':2}[input])%3 - 1
	j=100
	RNA_strand1+=input
	RNA_strand2+=ribonuclease[input+output]
	RNA_strand3+=output
	length = len(RNA_strand2)
	i = RNA_strand2.rfind(RNA_strand2[length-j:length-1],0,length-2)
	while not RNA_strand2[length-j:length-1] in RNA_strand2[0:length-2]:
		j-=1
		i = RNA_strand2.rfind(RNA_strand2[length-j:length-1],0,length-2)
		if j<2:
			break
	if i==-1 or j+i>=length:
		nucleotides[0] = nucleotides[3] = random.choice(['R','P','S'])
	else:
		nucleotides[0] = {'R':'P', 'P':'S', 'S':'R'}[RNA_strand1[j+i]]
		nucleotides[3] = {'R':'S', 'P':'R', 'S':'P'}[RNA_strand3[j+i]]
	nucleotides[6] = random.choice(['R','P','S'])	
	for i in [1,2,4,5]:
		nucleotides[i] = {'R':'S', 'P':'R', 'S':'P'}[nucleotides[i-1]]
	output = nucleotides[nucleic_acid.index(max(nucleic_acid))]