コード例 #1
0
 public static void generateDescendants(DNACode[] parents)
 {
     for (int i = 0; i < sample.Length; i++)
     {
         sample[i] = DNACode.combine(parents);
     }
 }
コード例 #2
0
    private void Test_combine()
    {
        int N = 100;

        for (int i = 0; i < N; i++)
        {
            DNACode[] parents = new DNACode[2];
            parents[0] = new DNACode().initialize();
            parents[1] = new DNACode().initialize();

            DNACode new_dna        = DNACode.combine(parents);
            int     total_quantity = new_dna.calculateTotalQuantity();
            int     correctValue   = new_dna.getSumatoryGenValues();

            Assert.That(total_quantity, Is.EqualTo(correctValue));
        }
    }
コード例 #3
0
 public static void generateDescendants(DNACode[] parents, bool keepParents)
 {
     if (keepParents)
     {
         for (int i = 0; i < parents.Length; i++)
         {
             sample[i] = parents[i];
         }
         for (int i = parents.Length; i < sample.Length; i++)
         {
             sample[i] = DNACode.combine(parents);
         }
     }
     else
     {
         generateDescendants(parents);
     }
 }