end detection

This commit is contained in:
Rendo 2025-11-08 18:56:34 +05:00
commit 5355a2c6af

View file

@ -13,6 +13,9 @@ impl<'a> NodeModifier<'a> {
let mut selected = root; let mut selected = root;
while random_range(0..PICK_STOP_PROBABILITY) == PICK_STOP_PROBABILITY - 1 { while random_range(0..PICK_STOP_PROBABILITY) == PICK_STOP_PROBABILITY - 1 {
let len = selected.children.len(); let len = selected.children.len();
if len == 0 {
break;
}
selected = &mut selected.children[random_range(0..len)]; selected = &mut selected.children[random_range(0..len)];
} }
NodeModifier { NodeModifier {
@ -34,4 +37,6 @@ impl<'a> NodeModifier<'a> {
node.children.push(moved); node.children.push(moved);
self.picked_node.children.insert(operated_index, node); self.picked_node.children.insert(operated_index, node);
} }
pub fn mutate_node(&mut self) {}
} }