Example #1
0
        static public DNA Combine(DNA vDNA1, DNA vDNA2)
        {
            DNA tNewDNA = new DNA();

            foreach (Gene tFirstGene in vDNA1.mGenes)
            {
                Gene tMatchingGene = FindMatchingGene(tFirstGene, vDNA2);
                if (tMatchingGene != null)
                {
                    tNewDNA.AddGene(tFirstGene.Combine(tMatchingGene));
                }
                else
                {
                    Debug.LogError("No matching Gene");
                }
            }
            return(tNewDNA);
        }
Example #2
0
        static public Gene FindMatchingGene(Gene vMyGene, DNA vOtherDNA)
        {
            Gene tMatch = vOtherDNA.mGenes.Find(o => o.GetType() == vMyGene.GetType());

            return(tMatch);
        }
Example #3
0
 public void AddGene(Gene vGene)
 {
     mGenes.Add(vGene);
 }
Example #4
0
 public abstract Gene Combine(Gene vOther);