Save deviation calculations to variables

This commit is contained in:
Nathen 2024-05-29 09:40:39 -04:00
parent a9b3416a3f
commit 1714567342
1 changed files with 8 additions and 5 deletions

View File

@ -129,6 +129,14 @@ private double computeAccuracyValue(ScoreInfo score, TaikoDifficultyAttributes a
const double z = 2.32634787404; // 99% critical value for the normal distribution (one-tailed).
double? deviationGreatWindow = calcDeviationGreatWindow();
double? deviationGoodWindow = calcDeviationGoodWindow();
if (deviationGreatWindow is null)
return deviationGoodWindow;
return Math.Min(deviationGreatWindow.Value, deviationGoodWindow!.Value);
// The upper bound on deviation, calculated with the ratio of 300s to objects, and the great hit window.
double? calcDeviationGreatWindow()
{
@ -163,11 +171,6 @@ private double computeAccuracyValue(ScoreInfo score, TaikoDifficultyAttributes a
// We can be 99% confident that the deviation is not higher than:
return h100 / (Math.Sqrt(2) * SpecialFunctions.ErfInv(pLowerBound));
}
if (calcDeviationGreatWindow() is null)
return calcDeviationGoodWindow();
return Math.Min(calcDeviationGreatWindow()!.Value, calcDeviationGoodWindow()!.Value);
}
private int totalHits => countGreat + countOk + countMeh + countMiss;