Module: TreeChopMutator

Defined in:
lib/charlie/tree/tree.rb

Overview

replace root by one of its children, i.e. TreeRemoveNodeMutator with the root instead of a random node.

Instance Method Summary collapse

Instance Method Details

#mutate!Object



216
217
218
219
220
# File 'lib/charlie/tree/tree.rb', line 216

def mutate!
  return self if genes.first==:term
  genes.replace genes[1..-1].at_rand # replace root with child
  self
end