Skip to content

Commit

Permalink
Add symbiont within-lifetime mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
emilydolson committed Mar 26, 2024
1 parent 09cd0ea commit 00163fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions source/ConfigSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ EMP_BUILD_CONFIG(SymConfigBase,
VALUE(INT_VAL_MUT_RATE, double, -1, "The overall mutation rate of the interaction value trait in symbionts, -1 makes it same as mutation rate as determined by tranmission mode"),
VALUE(HORIZ_MUTATION_SIZE, double, -1, "Standard deviation of the distribution to mutate by for horizontal transmission, if -1 MUTATION_SIZE used"),
VALUE(HORIZ_MUTATION_RATE, double, -1, "Value 0 to 1 of probability of mutation for horizontal transmission, if -1 MUTATION_RATE used"),
VALUE(SYM_WITHIN_LIFETIME_MUTATION_RATE, double, 0, "Value 0 to 1 of probability of mutation for symbiont every time step"),

GROUP(ECTOSYMBIOSIS, "Settings for ectosymbiosis and free-living symbionts"),
VALUE(FREE_LIVING_SYMS, bool, 0, "Are symbionts able to live outside of the host?"),
Expand Down
7 changes: 6 additions & 1 deletion source/default_mode/Symbiont.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,12 @@ class Symbiont: public Organism {
HorizontalTransmission(location);
//Age the organism
GrowOlder();
//Check if the organism should move and do it
if (my_config->SYM_WITHIN_LIFETIME_MUTATION_RATE()) {
if (random->P(my_config->SYM_WITHIN_LIFETIME_MUTATION_RATE())) {
Mutate();
}
}
//Check if the organism should move and do it
if (my_host.IsNull() && my_config->FREE_LIVING_SYMS() && !dead) {
//if the symbiont should move, and hasn't been killed
my_world->MoveFreeSym(location);
Expand Down

0 comments on commit 00163fd

Please sign in to comment.