2022-06-06 12:42:49 +08:00
|
|
|
using System;
|
|
|
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
|
|
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
|
|
|
{
|
|
|
|
public class ColourEvaluator
|
|
|
|
{
|
2022-06-09 17:22:55 +08:00
|
|
|
// TODO - Share this sigmoid
|
2022-06-06 12:42:49 +08:00
|
|
|
private static double sigmoid(double val, double center, double width)
|
|
|
|
{
|
|
|
|
return Math.Tanh(Math.E * -(val - center) / width);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static double EvaluateDifficultyOf(DifficultyHitObject current)
|
|
|
|
{
|
|
|
|
TaikoDifficultyHitObject taikoCurrent = (TaikoDifficultyHitObject)current;
|
|
|
|
TaikoDifficultyHitObjectColour colour = taikoCurrent.Colour;
|
|
|
|
if (colour == null) return 0;
|
2022-06-09 17:22:55 +08:00
|
|
|
|
2022-06-09 19:41:59 +08:00
|
|
|
double objectStrain = 2.1;
|
2022-06-09 17:22:55 +08:00
|
|
|
|
2022-06-06 12:42:49 +08:00
|
|
|
if (colour.Delta)
|
|
|
|
{
|
2022-06-09 19:41:59 +08:00
|
|
|
objectStrain *= sigmoid(colour.DeltaRunLength, 4, 4) * 0.5 + 0.5;
|
2022-06-06 12:42:49 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-06-09 12:35:26 +08:00
|
|
|
objectStrain *= sigmoid(colour.DeltaRunLength, 2, 2) * 0.5 + 0.5;
|
2022-06-06 12:42:49 +08:00
|
|
|
}
|
2022-06-09 17:22:55 +08:00
|
|
|
|
2022-06-07 13:30:24 +08:00
|
|
|
objectStrain *= -sigmoid(colour.RepetitionInterval, 8, 8) * 0.5 + 0.5;
|
2022-06-09 19:41:59 +08:00
|
|
|
// Console.WriteLine($"{current.StartTime},{colour.Delta},{colour.RepetitionInterval},{objectStrain}");
|
2022-06-06 12:42:49 +08:00
|
|
|
return objectStrain;
|
|
|
|
}
|
|
|
|
}
|
2022-06-09 17:22:55 +08:00
|
|
|
}
|