Module: Evolvable::Gene::ClassMethods

Defined in:
lib/evolvable/gene.rb

Instance Method Summary collapse

Instance Method Details

#combine(gene_a, gene_b) ⇒ Object Also known as: crossover


47
48
49
50
51
# File 'lib/evolvable/gene.rb', line 47

def combine(gene_a, gene_b)
  genes = [gene_a, gene_b]
  genes.compact!
  genes.sample
end

#keyObject


43
44
45
# File 'lib/evolvable/gene.rb', line 43

def key
  @key
end

#key=(val) ⇒ Object


39
40
41
# File 'lib/evolvable/gene.rb', line 39

def key=(val)
  @key = val
end