private Phenotype CreatePhenotype(List <Gene> newGenotype) { var newPhenotype = new Phenotype(); foreach (var aGene in newGenotype) { var fatherQueryResult = TraitUtils.QueryTraitValue(aGene.Trait, aGene.FatherGene); var motherQueryResult = TraitUtils.QueryTraitValue(aGene.Trait, aGene.MotherGene); TraitValueQueryResult strongerQueryResult; if (fatherQueryResult.Strength > motherQueryResult.Strength) { strongerQueryResult = fatherQueryResult; } else if (fatherQueryResult.Strength < motherQueryResult.Strength) { strongerQueryResult = motherQueryResult; } else { strongerQueryResult = _random.NextBool() ? fatherQueryResult : motherQueryResult; } TraitUtils.SetQueryValue(strongerQueryResult.QuantisizedEnumValue, newPhenotype); } return(newPhenotype); }
public void CreateGenotypeFromPhenotype() { Genotype = TraitUtils.CreateGenotypeFromPhenotype(Phenotype, Genotype); }