Changeset 674


Ignore:
Timestamp:
08/19/17 02:45:00 (7 years ago)
Author:
Maciej Komosinski
Message:

f4 modifiers implemented similarly to f1 modifiers, and a base for support for excluding selected modifiers in f4 mutations

Location:
cpp/frams/genetics/f4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/f4/oper_f4.cpp

    r671 r674  
    1616
    1717
     18//see also modifiers in f1
     19#define F4_MODIFIERS_VISUAL "" //not supported in f4
     20#define F4_MODIFIERS_RARE "EeWwAaSs" //expdef would need to handle these properly/specifically to ensure reasonable behavior, and hardly any expdef does. Modifying initial energy of a creature as a result of its genes (Ee) is in general not a good idea. Weight (Ww) works only in water, and there sinking/going up should usually be caused by real activity of a creature, not by its inherited weight. For assimilation (Aa) , there is a dedicated parameter in CreaturesGroup. Stamina (Ss) is no longer needed as destructive collisions are not supported, and even if they were, some expdef would need to impose reasonable restrictions on the value of this parameter (e.g. similar to normalizeBiol4()) and the specific consequences of destructions should be defined as needed.
     21#define F4_MODIFIERS "LlRrCcQqFfMmIi" F4_MODIFIERS_RARE F4_MODIFIERS_VISUAL //TODO no Rr in f4?
     22const char *Geno_f4::all_modifiers = F4_MODIFIERS;
     23
    1824#define FIELDSTRUCT Geno_f4
    1925
    2026static ParamEntry GENO4param_tab[] =
    2127{
    22         { "Genetics: f4", 1, F4_COUNT + F4_ADD_COUNT, },
     28        { "Genetics: f4", 1, F4_COUNT + F4_ADD_COUNT + 1, },
    2329        { "f4_mut_add", 0, 0, "Add node", "f 0 100 50", FIELD(prob[F4_ADD]), "mutation: probability of adding a node", },
    2430        { "f4_mut_add_div", 0, 0, "- add division", "f 0 100 20", FIELD(probadd[F4_ADD_DIV]), "add node mutation: probability of adding a division", },
     
    2935        { "f4_mut_del", 0, 0, "Delete node", "f 0 100 20", FIELD(prob[F4_DEL]), "mutation: probability of deleting a node", },
    3036        { "f4_mut_mod", 0, 0, "Modify node", "f 0 100 30", FIELD(prob[F4_MOD]), "mutation: probability of changing a node", },
     37        { "f4_mut_exmod", 1, 0, "Excluded modifiers", "s 0 30", FIELD(excluded_modifiers), "Modifiers that will not be added nor deleted during mutation\n(all: " F4_MODIFIERS ")", },
    3138        { 0, },
    3239};
     
    5259        mutation_method_names[index++] = "modified a node";
    5360        if (index != F4_COUNT + F4_ADD_COUNT - 1) logMessage("Geno_f4", "Constructor", 3, "Mutation names init error");
     61}
     62
     63void Geno_f4::setDefaults()
     64{
     65        excluded_modifiers = F4_MODIFIERS_RARE F4_MODIFIERS_VISUAL;
    5466}
    5567
  • cpp/frams/genetics/f4/oper_f4.h

    r671 r674  
    3333public:
    3434        Geno_f4();
     35        void setDefaults();
     36
    3537        int checkValidity(const char *, const char *genoname);
    3638        int validate(char *&, const char *genoname);
     
    4244        // mutation probabilities
    4345        double prob[F4_COUNT], probadd[F4_ADD_COUNT];
     46
     47        SString excluded_modifiers; //not to be used in mutations
     48        static const char *all_modifiers;
    4449
    4550protected:
Note: See TracChangeset for help on using the changeset viewer.