Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
ant dna skill-processor
# computed sample at https://gist.github.com/164138
genes = %w(A C G T)
strength = ".AG. GC.. ...A ..GC AC.. GT.. T.TC ...."
size = "CG.. .... ...C ..T. ..AC .... ...C ..A."
weight = "TC.C C... ..CG TG.C .... GC.A .GG. .AAA"
ant = ''
(0..31).each do |i|
ant += genes[rand(4)]
ant += ' ' if ((i % 4) == 3)
end
puts ant
ant = ant.split('')
ant_size = 0
size.split('').each_with_index do |value,key|
next if value == '.' or value == ' '
ant_size += 1 if ant[key] == value
ant_size -= 1 if ant[key] == genes[(genes.index(value) + 2) % 4]
end
puts 'size: %i ' % ant_size
ant_strength = 0
strength.split('').each_with_index do |value,key|
next if value == '.' or value == ' '
ant_strength += 1 if ant[key] == value
ant_strength -= 1 if ant[key] == genes[(genes.index(value) + 2) % 4]
end
puts 'strength: %i ' % ant_strength
ant_weight = 0
weight.split('').each_with_index do |value,key|
next if value == '.' or value == ' '
ant_weight += 1 if ant[key] == value
ant_weight -= 1 if ant[key] == genes[(genes.index(value) + 2) % 4]
end
puts 'weight: %i ' % ant_weight
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.