diff --git a/src/population.rs b/src/population.rs index c18bd2b..14f79f3 100644 --- a/src/population.rs +++ b/src/population.rs @@ -172,6 +172,9 @@ impl Population { self.species.push(new_specie.unwrap()); } } + + // Remove species that no longer have any organisms. + self.species.retain(|s| ! s.organisms.is_empty()); } fn create_organisms(&mut self, population_size: usize) {