Пример #1
0
        public static double CalcRating(BeatmapInfo map, PatternAnalyzer pat)
        {
            //  Variable : JenksDensity, Key, Od, Jack, Spam, Vibro
            //  Step 1 : Pattern Score
            //  Start from 'Jenks Density / key'
            var patScore = map.JenksDensity / map.Data.Keys;

            //  Step 2 : The final rating.

            //  Not implemented yet.
            return(0.0);
        }
Пример #2
0
        public static double CalcJackScore(PatternAnalyzer pat)
        {
            var jackScore = 0.0;

            foreach (var curJack in pat.JackSectionList)
            {
                for (var i = 0; i < curJack.Count; i++)
                {
                    double gap1 = 0, gap2 = 0;
                    if (i > 0)
                    {
                        gap1 = GetJackBpmScore(BpmConverter.MillisecondsToBpm(curJack[i].Time - curJack[i - 1].Time));
                    }
                    if (i < curJack.Count - 1)
                    {
                        gap2 = GetJackBpmScore(BpmConverter.MillisecondsToBpm(curJack[i + 1].Time - curJack[i].Time));
                    }

                    jackScore += (gap1 + gap2) / (Math.Abs(gap1) < 0.001 || Math.Abs(gap2) < 0.001 ? 1 : 2) * GetJackTimesScore(curJack.Count);
                }
            }

            return(jackScore / pat.Count);
        }
Пример #3
0
        private static void CalcDensityList(ref List <Note> notes, ref List <LongNote> lns, int key, out List <double> density)
        {
            int Key;

            var corNotes = new List <NoteCount>();
            var corLNs   = new List <LongNoteCount>();

            var Notes = new List <Note>();
            var LNs   = new List <LongNote>();

            density = new List <double>();
            var specialStyle = PatternAnalyzer.IsSpecialStyle(notes, lns);

            if (!specialStyle)
            {
                Notes = notes;
                LNs   = lns;
                Key   = key;
            }
            else
            {
                Notes.AddRange(notes.Where(cur => cur.Lane != 0));
                LNs.AddRange(lns.Where(cur => cur.Lane != 0));
                Key = key - 1;
            }

            var periods     = GetPeriods(ref notes, ref lns);
            var startPeriod = periods.Item1;
            var endPeriod   = periods.Item2;

            for (var i = startPeriod; i < endPeriod - 1000; i += 250)
            {
                corNotes.Clear();
                corLNs.Clear();

                //  Get the notes in current period.
                corNotes.AddRange(from cur in Notes where cur.Time >= i && cur.Time <= i + 1000 select new NoteCount(cur.Time, cur.Lane, 0));

                corLNs.AddRange(
                    from cur in LNs
                    where (cur.Time >= i && cur.Time <= i + 1000) ||
                    (cur.EndTime >= i && cur.EndTime <= i + 1000) ||
                    (cur.Time <= i && cur.EndTime >= i + 1000)
                    select new LongNoteCount(cur.Time, cur.EndTime, cur.Lane, 0));

                //  Count the LN-count for each notes.
                foreach (var cur in corLNs)
                {
                    foreach (var note in corNotes)
                    {
                        if (note.Time >= cur.Time && note.Time < cur.EndTime)
                        {
                            note.LNs++;
                        }
                    }

                    for (var j = corLNs.IndexOf(cur) + 1; j < corLNs.Count; j++)
                    {
                        if ((corLNs[j].Time >= cur.Time && corLNs[j].Time < cur.EndTime) ||
                            (corLNs[j].EndTime >= cur.Time && corLNs[j].EndTime <= cur.EndTime) ||
                            (corLNs[j].Time <= cur.Time && corLNs[j].EndTime >= cur.EndTime))
                        {
                            corLNs[j].LNs++;
                        }
                    }
                }

                //  Correct the density.
                var den = corNotes.Sum(cur => (double)Key / (Key - cur.LNs)) +
                          corLNs.Sum(cur => (double)Key / (Key - cur.LNs) * 1.1);

                density.Add(den);
            }
        }