Skip to content

Commit

Permalink
Remove species that no longer have any organisms.
Browse files Browse the repository at this point in the history
Fixes TLmaK0#19.
  • Loading branch information
Justus Winter committed May 4, 2020
1 parent 0a9f136 commit 1784757
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/population.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1784757

Please sign in to comment.