Exemple #1
0
    public static Genome GenerateRandomGenome()
    {
        Genome genome = new Genome();

        foreach (string traitSetName in GeneReader.GetBinomialTraitNames())
        {
            GeneReader.BinomialAlleles alleles = GetRandomBinomialAllele();
            genome.AddTrait(traitSetName, alleles);
        }
        return(genome);
    }
Exemple #2
0
    public Genome BreedWith(Genome mate)
    {
        Genome child = new Genome();

        foreach (string traitSetName in GeneReader.GetBinomialTraitNames())
        {
            GeneReader.BinomialAlleles thisAlleles  = genome[traitSetName];
            GeneReader.BinomialAlleles otherAlleles = mate.genome[traitSetName];
            GeneReader.BinomialAlleles childAlleles = GeneReader.Punnet(thisAlleles, otherAlleles);
            child.AddTrait(traitSetName, childAlleles);
        }
        return(child);
    }