Skip to content

Commit

Permalink
Zero memory if emtpy (should be redundant)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmore500 committed Dec 13, 2023
1 parent fca2971 commit d443d4b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion avida-core/source/main/cDeme.cc
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@ int cDeme::GetNumParasites() const
}

void cDeme::UpdateParasiteMemoryScore(const double decay) {
if (GetSize() == 0) return;
if (GetSize() == 0) {
SetParasiteMemoryScore(0.0);
return;
}
const double inc = static_cast<double>(GetNumParasites()) / GetSize();
SetParasiteMemoryScore(GetParasiteMemoryScore() * decay + inc);
}
Expand Down

0 comments on commit d443d4b

Please sign in to comment.