Exemplo n.º 1
0
 public static float[] CrossAvg(OrgStats f, OrgStats s, float mutRate, int mutChances)
 {
     float[] gene  = new float[4];
     float[] first = f.Gene(), second = s.Gene();
     for (int i = 0; i < 4; ++i)
     {
         gene[i] = (first[i] + second[i]) / 2;
     }
     return(Mutate(gene, mutRate, mutChances));
 }
Exemplo n.º 2
0
 public static float[] CrossAlternate(OrgStats f, OrgStats s, bool start, float mutRate, int mutChances)
 {
     float[] gene  = new float[4];
     float[] first = f.Gene(), second = s.Gene();
     for (int i = 0; i < 4; ++i, start = !start)
     {
         if (start)
         {
             gene[i] = first[i];
         }
         else
         {
             gene[i] = second[i];
         }
     }
     return(Mutate(gene, mutRate, mutChances));
 }