Skip to content

Commit 1784757

Browse files
author
Justus Winter
committed
Remove species that no longer have any organisms.
Fixes TLmaK0#19.
1 parent 0a9f136 commit 1784757

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: src/population.rs

+3
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ impl Population {
172172
self.species.push(new_specie.unwrap());
173173
}
174174
}
175+
176+
// Remove species that no longer have any organisms.
177+
self.species.retain(|s| ! s.organisms.is_empty());
175178
}
176179

177180
fn create_organisms(&mut self, population_size: usize) {

0 commit comments

Comments
 (0)