From cb5ea6aa9a54d26d454456837fc1b15dbb7f7819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 18 Aug 2020 19:59:28 +0200 Subject: [PATCH] Generalise p-norm function --- .../Difficulty/TaikoDifficultyCalculator.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index 7a9f1765ae..aa21df0228 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -49,13 +49,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty return 0.79 - Math.Atan(staminaDifficulty / colorDifficulty - 12) / Math.PI / 2; } - private double norm(double p, double v1, double v2, double v3) + private double norm(double p, params double[] values) { - return Math.Pow( - Math.Pow(v1, p) + - Math.Pow(v2, p) + - Math.Pow(v3, p) - , 1 / p); + return Math.Pow(values.Sum(x => Math.Pow(x, p)), 1 / p); } private double rescale(double sr)