end detection
This commit is contained in:
parent
0f3ee41673
commit
5355a2c6af
1 changed files with 5 additions and 0 deletions
|
|
@ -13,6 +13,9 @@ impl<'a> NodeModifier<'a> {
|
|||
let mut selected = root;
|
||||
while random_range(0..PICK_STOP_PROBABILITY) == PICK_STOP_PROBABILITY - 1 {
|
||||
let len = selected.children.len();
|
||||
if len == 0 {
|
||||
break;
|
||||
}
|
||||
selected = &mut selected.children[random_range(0..len)];
|
||||
}
|
||||
NodeModifier {
|
||||
|
|
@ -34,4 +37,6 @@ impl<'a> NodeModifier<'a> {
|
|||
node.children.push(moved);
|
||||
self.picked_node.children.insert(operated_index, node);
|
||||
}
|
||||
|
||||
pub fn mutate_node(&mut self) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue