Пример #1
0
        public static double CalculateRegularity(List <NeatPlayer> players)
        {
            List <int>[] rests;
            double[][]   outputs;

            double[][] durations      = FitnessUtils.GetRhythmOutput(players, out rests, out outputs);
            double[]   inputs         = FitnessUtils.GetRhythmInput();
            double[]   inputDurations = FitnessUtils.GetRhythmInputDurations();

            double fitness = PERFECT_RHYTHM_SCORE;

            //double distanceFromTotal = DistanceFromTotal(durations);
            //fitness -= distanceFromTotal;

            int tooFew = TooFew(inputDurations, durations, rests) * 10;

            fitness -= tooFew;

            int tooMany = TooMany(inputDurations, durations);

            fitness -= tooMany;

            int sameDurationsInput   = SameDurationsInput(inputDurations, durations) * 20;
            int sameDurationsOutputs = SameDurationsModules(durations) * 10;

            fitness -= sameDurationsInput;
            fitness -= sameDurationsOutputs;

            int restCheck = RestCheck(inputs, durations, rests);

            fitness -= restCheck;

            //makes sure an appropriate number of modules are playing at the same time
            //int differentTimes = PlayingAtDifferentTimes(durations, rests, inputs) / 10;
            //fitness -= differentTimes;

            int standardDeviation = StandardDeviation(outputs[0]);

            fitness -= standardDeviation;

            int onBeat = OnBeat(durations) * 10;

            fitness -= onBeat;

            return(fitness);
        }
Пример #2
0
        public static double CalculateRegularity(List <NeatPlayer> players)
        {
            List <int>[] rests;
            double[][]   outputs;

            double[][] durations      = FitnessUtils.GetRhythmOutput(players, out rests, out outputs);
            double[]   inputs         = FitnessUtils.GetRhythmInput();
            double[]   inputDurations = FitnessUtils.GetRhythmInputDurations();

            double fitness = PERFECT_RHYTHM_SCORE;

            double distanceFromTotal = DistanceFromTotal(durations);

            fitness -= distanceFromTotal;

            int tooFew = TooFew(inputs, durations, rests);

            fitness -= tooFew;

            int tooMany = TooMany(inputs, durations);

            fitness -= tooMany;

            int sameDurations = SameDurationsInput(inputDurations, durations);

            sameDurations += SameDurationsModules(durations);
            fitness       -= sameDurations;

            int restCheck = RestCheck(inputs, durations, rests);

            fitness -= restCheck;

            int differentTimes = PlayingAtDifferentTimes(durations, rests, inputs);

            //fitness -= differentTimes;

            return(fitness);
        }