class Gene

A Gene can take different values, randomly mutate.

Gene class build methods

Constants

MISSING_IMPL_ERR_FMT

Public Class Methods

Enum(enum_values) click to toggle source
# File lib/gene.rb, line 88
def self.Enum(enum_values)
  EnumGene.new(enum_values)
end
Float(min, max) click to toggle source
# File lib/gene.rb, line 84
def self.Float(min, max)
  FloatGene.new(min, max)
end
Integer(min, max) click to toggle source
# File lib/gene.rb, line 80
def self.Integer(min, max)
  IntegerGene.new(min, max)
end

Public Instance Methods

create_random() click to toggle source
# File lib/gene.rb, line 11
def create_random
  Allele.new(self, random_allele_value)
end
mutate(_allele) click to toggle source
# File lib/gene.rb, line 3
def mutate(_allele)
  raise_missing_impl :mutate
end
random_allele_value() click to toggle source
# File lib/gene.rb, line 7
def random_allele_value
  raise_missing_impl :random_allele_value
end

Private Instance Methods

raise_missing_impl(func) click to toggle source
# File lib/gene.rb, line 20
def raise_missing_impl(func)
  raise MISSING_IMPL_ERR_FMT % func
end