public Genes <T> Child(Genes <T> gene1, Genes <T> gene2) { if (gene1.phenotypes.Count != gene2.phenotypes.Count) { throw new System.Exception("phenotype dictionarys do not match"); } Genes <T> child = new Genes <T>(gene1.phenotypes); for (int i = 0; i < gene1.genotype.Length; i++) { int num = Random.Range(0, 2); if (num == 0) { child.genotype += gene1.genotype[i]; } else { child.genotype += gene2.genotype[i]; } } child.SetPhenotype(); return(child); }