moonlander_gp

Trait Mutatable

Source
pub trait Mutatable {
    // Required method
    fn mutate(&self, max_height: i32, rng: &mut dyn Rng) -> Box<dyn AstNode>;
}
Expand description

Mutation trait for nodes

Implement this if you want to do controlled mutation of nodes. For example, changing the node type without changing the children, or changing the number value in a controlled way.

When not explicitly specified, a default implementation is provided for nodes that also implement RandNode, which completely replaces the node with a random subtree.

Required Methods§

Source

fn mutate(&self, max_height: i32, rng: &mut dyn Rng) -> Box<dyn AstNode>

Return a mutation of this node

Implementors§