Ejemplo n.º 1
0
        /// <summary>
        /// Returns the partial star rating of the beatmap, calculated using peak strains from all sections of the map.
        /// </summary>
        /// <remarks>
        /// For each section, the peak strains of all separate skills are combined into a single peak strain for the section.
        /// The resulting partial rating of the beatmap is a weighted sum of the combined peaks (higher peaks are weighted more).
        /// </remarks>
        private double locallyCombinedDifficulty(Colour colour, Rhythm rhythm, Stamina staminaRight, Stamina staminaLeft, double staminaPenalty)
        {
            List <double> peaks = new List <double>();

            var colourPeaks       = colour.GetCurrentStrainPeaks().ToList();
            var rhythmPeaks       = rhythm.GetCurrentStrainPeaks().ToList();
            var staminaRightPeaks = staminaRight.GetCurrentStrainPeaks().ToList();
            var staminaLeftPeaks  = staminaLeft.GetCurrentStrainPeaks().ToList();

            for (int i = 0; i < colourPeaks.Count; i++)
            {
                double colourPeak  = colourPeaks[i] * colour_skill_multiplier;
                double rhythmPeak  = rhythmPeaks[i] * rhythm_skill_multiplier;
                double staminaPeak = (staminaRightPeaks[i] + staminaLeftPeaks[i]) * stamina_skill_multiplier * staminaPenalty;
                peaks.Add(norm(2, colourPeak, rhythmPeak, staminaPeak));
            }

            double difficulty = 0;
            double weight     = 1;

            foreach (double strain in peaks.OrderByDescending(d => d))
            {
                difficulty += strain * weight;
                weight     *= 0.9;
            }

            return(difficulty);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the partial star rating of the beatmap, calculated using peak strains from all sections of the map.
        /// </summary>
        /// <remarks>
        /// For each section, the peak strains of all separate skills are combined into a single peak strain for the section.
        /// The resulting partial rating of the beatmap is a weighted sum of the combined peaks (higher peaks are weighted more).
        /// </remarks>
        private double locallyCombinedDifficulty(Colour colour, Rhythm rhythm, Stamina stamina, double staminaPenalty)
        {
            List <double> peaks = new List <double>();

            var colourPeaks  = colour.GetCurrentStrainPeaks().ToList();
            var rhythmPeaks  = rhythm.GetCurrentStrainPeaks().ToList();
            var staminaPeaks = stamina.GetCurrentStrainPeaks().ToList();

            for (int i = 0; i < colourPeaks.Count; i++)
            {
                double colourPeak  = colourPeaks[i] * colour_skill_multiplier;
                double rhythmPeak  = rhythmPeaks[i] * rhythm_skill_multiplier;
                double staminaPeak = staminaPeaks[i] * stamina_skill_multiplier * staminaPenalty;

                double peak = norm(2, colourPeak, rhythmPeak, staminaPeak);

                // Sections with 0 strain are excluded to avoid worst-case time complexity of the following sort (e.g. /b/2351871).
                // These sections will not contribute to the difficulty.
                if (peak > 0)
                {
                    peaks.Add(peak);
                }
            }

            double difficulty = 0;
            double weight     = 1;

            foreach (double strain in peaks.OrderByDescending(d => d))
            {
                difficulty += strain * weight;
                weight     *= 0.9;
            }

            return(difficulty);
        }