diff --git a/source/ConfigSetup.h b/source/ConfigSetup.h index b821cb4f..a5677f37 100644 --- a/source/ConfigSetup.h +++ b/source/ConfigSetup.h @@ -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?"), diff --git a/source/default_mode/Symbiont.h b/source/default_mode/Symbiont.h index 6b50360f..3e6db9f7 100644 --- a/source/default_mode/Symbiont.h +++ b/source/default_mode/Symbiont.h @@ -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);