1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:20:04 +08:00

Improve readability

This commit is contained in:
Andrei Zavatski 2024-02-03 00:19:04 +03:00
parent dde7e068a4
commit 57bc5ee04f

View File

@ -21,30 +21,28 @@ namespace osu.Game.Rulesets.Scoring
{ {
Debug.Assert(hitEvents.All(ev => ev.GameplayRate != null)); Debug.Assert(hitEvents.All(ev => ev.GameplayRate != null));
double currentValue; int count = 0;
int k = 0;
double m = 0; double m = 0;
double s = 0; double s = 0;
double mNext;
foreach (var e in hitEvents) foreach (var e in hitEvents)
{ {
if (!affectsUnstableRate(e)) if (!affectsUnstableRate(e))
continue; continue;
// Division by gameplay rate is to account for TimeOffset scaling with gameplay rate. count++;
currentValue = e.TimeOffset / e.GameplayRate!.Value;
k++; // Division by gameplay rate is to account for TimeOffset scaling with gameplay rate.
mNext = m + (currentValue - m) / k; double currentValue = e.TimeOffset / e.GameplayRate!.Value;
double mNext = m + (currentValue - m) / count;
s += (currentValue - m) * (currentValue - mNext); s += (currentValue - m) * (currentValue - mNext);
m = mNext; m = mNext;
} }
if (k == 0) if (count == 0)
return null; return null;
return 10.0 * Math.Sqrt(s / k); return 10.0 * Math.Sqrt(s / count);
} }
/// <summary> /// <summary>