コード例 #1
0
    private Population GetFirstPopulation()
    {
        // ну шоб наверняка
        Variation baseVariation = new Variation(CurrentEffectiveBotSkillPoints / 5 + CurrentEffectiveBotSkillPoints % 5,
                                                0, CurrentEffectiveBotSkillPoints / 5,
                                                CurrentEffectiveBotSkillPoints / 5, CurrentEffectiveBotSkillPoints / 5, CurrentEffectiveBotSkillPoints / 5);

        int amount = parentsAmount * mutationsPerParent;
        List <Variation> variations = new List <Variation>(amount);

        variations.Add(baseVariation);

        for (int i = 1; i < amount; i++)
        {
            Variation variation = baseVariation.Mutate(rngesus.Next(1, maxMutationValue + 1), rngesus.Next(1, maxCompensationFields + 1), CurrentEffectiveBotSkillPoints);
            if (variation == null)
            {
                continue;
            }
            variations.Add(variation);
        }

        return(new Population(variations.ToArray(), new Variation[] { baseVariation }));
    }