예제 #1
0
    /// <summary>
    /// Computes the scores of the given population according
    /// to the wanted genotype
    /// </summary>
    /// <param name="population">The current population</param>
    /// <param name="genotype">The genotype to compare an element with</param>
    /// <returns>The scores of the population</returns>
    static int[] Evaluate(Genotype[] population, Genotype genotype)
    {
        int[] scores = new int[population.Length];

        for (int n = 0; n < population.Length; n++)
        {
            scores[n] = Genotype.CountSameBits(population[n], genotype);
        }

        return(scores);
    }