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);
|
|
|
|
}
|
|
|
|
|
2022-07-01 14:27:23 +08:00
|
|
|
public static double EvaluateDifficultyOf(ColourEncoding encoding)
|
|
|
|
{
|
|
|
|
return 1 / Math.Pow(encoding.MonoRunLength, 0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static double EvaluateDifficultyOf(CoupledColourEncoding coupledEncoding)
|
|
|
|
{
|
|
|
|
double difficulty = 0;
|
|
|
|
for (int i = 0; i < coupledEncoding.Payload.Length; i++)
|
|
|
|
{
|
|
|
|
difficulty += EvaluateDifficultyOf(coupledEncoding.Payload[i]);
|
|
|
|
}
|
|
|
|
return difficulty;
|
|
|
|
}
|
|
|
|
|
2022-06-28 10:38:58 +08:00
|
|
|
public static double EvaluateDifficultyOf(TaikoDifficultyHitObjectColour? colour)
|
2022-06-06 12:42:49 +08:00
|
|
|
{
|
2022-06-28 10:38:58 +08:00
|
|
|
if (colour == null) return 0;
|
|
|
|
|
2022-07-01 14:27:23 +08:00
|
|
|
// double difficulty = 9.5 * Math.Log(colour.Encoding.Payload.Length + 1, 10);
|
|
|
|
double difficulty = 3 * EvaluateDifficultyOf(colour.Encoding);
|
2022-06-28 10:38:58 +08:00
|
|
|
// foreach (ColourEncoding encoding in colour.Encoding.Payload)
|
|
|
|
// {
|
|
|
|
// difficulty += sigmoid(encoding.MonoRunLength, 1, 1) * 0.4 + 0.6;
|
|
|
|
// }
|
2022-07-01 14:27:23 +08:00
|
|
|
// difficulty *= -sigmoid(colour.RepetitionInterval, 1, 7);
|
|
|
|
difficulty *= -sigmoid(colour.RepetitionInterval, 6, 5) * 0.5 + 0.5;
|
2022-06-28 10:38:58 +08:00
|
|
|
|
|
|
|
return difficulty;
|
2022-06-06 12:42:49 +08:00
|
|
|
}
|
2022-06-23 17:10:30 +08:00
|
|
|
|
|
|
|
public static double EvaluateDifficultyOf(DifficultyHitObject current)
|
|
|
|
{
|
|
|
|
return EvaluateDifficultyOf(((TaikoDifficultyHitObject)current).Colour);
|
|
|
|
}
|
2022-06-06 12:42:49 +08:00
|
|
|
}
|
2022-06-09 17:22:55 +08:00
|
|
|
}
|