Esempio n. 1
0
 public static void Mute(AI.DNA dna, ICollection <string> keys, int rate, float min, float max)
 {
     string[] banned = new string[] { "f5", "name", "generation" };
     foreach (string key in keys)
     {
         if (!string.IsNullOrEmpty(key))
         {
             bool ok = true;
             for (int i = 0; i < banned.Length; i++)
             {
                 if (banned[i] == key)
                 {
                     ok = false;
                     break;
                 }
             }
             if (ok)
             {
                 dna.SetValue(key, (float)Utility.RandomValue(dna.GetValue(key), rate, min, max));
             }
         }
     }
 }