From 17145673421118baee2d6971277771625512a78a Mon Sep 17 00:00:00 2001 From: Nathen Date: Wed, 29 May 2024 09:40:39 -0400 Subject: [PATCH] Save deviation calculations to variables --- .../Difficulty/TaikoPerformanceCalculator.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs index ca11397801..a8ccaedfd0 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs @@ -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;