Beispiel #1
0
            ///<summary>Return a piece of DNA by doing crossover and mutation on random DNA in gene pool weighted by fitness</summary>
            public T birth()
            {
                ADNA <T> dna = m_gene_pool.getRandomObject().DNAcrossover(m_gene_pool.getRandomObject().getSelf());

                if (RandomCalc.ChanceRoll(m_mutation_chance_percentage * 100))
                {
                    dna = dna.DNAmutate();
                }

                m_creatures_birthed++;
                return(dna.getSelf());
            }
Beispiel #2
0
 ///<summary>DNA will be added by fitness and sorted</summary>
 public void addDNA(ADNA <T> p_dna, float fitness)
 {
     m_gene_pool.add(fitness, p_dna);
     // Debug.Log(m_gene_pool);
 }