This program has been disqualified.
Author | dllu |
Submission date | 2011-06-10 21:12:02.201917 |
Rating | 6981 |
Matches played | 53 |
Win rate | 69.81 |
#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':'l','PS':'o','SR':'r','PR':'e','SP':'m','RS':'i','RR':'p','PP':'s','SS':'u'}
nucleotides = ['R','R','R','R','R','R','R']
nucleic_acid = [0,0,0,0,0,0,0]
else:
for i in range(7):
if nucleotides[i] == {'R':'P', 'P':'S', 'S':'R'}[input]:
#win? add one nucleic acid!
nucleic_acid[i]+=1
elif input == {'R':'P', 'P':'S', 'S':'R'}[nucleotides[i]]:
#if you lose, you suck so you get reset to zero.
nucleic_acid[i] = 0
m = max(nucleic_acid)
bestlist = [i for i, c in enumerate(nucleic_acid) if c == m]
index = random.choice(bestlist)
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]] #I will beat what you would play if you follow the same pattern
nucleotides[3] = {'R':'S', 'P':'R', 'S':'P'}[RNA_strand3[j+i]] #I will beat what you would play if you try to beat what I play
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]] #I will beat you if you try to second guess me.
output = nucleotides[index]