mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 13:23:22 +08:00
Partial Review changes
This commit is contained in:
parent
9e299bb88b
commit
cb63ec282e
@ -10,14 +10,18 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
||||
{
|
||||
public class ColourEvaluator
|
||||
{
|
||||
private static double sigmoid(double val, double center, double width)
|
||||
/// <summary>
|
||||
/// A sigmoid function. It gives a value between (middle - height/2) and (middle + height/2).
|
||||
/// </summary>
|
||||
/// <param name="val">The input value.</param>
|
||||
/// <param name="center">The center of the sigmoid, where the largest gradient occurs and value is equal to middle.</param>
|
||||
/// <param name="width">The radius of the sigmoid, outside of which values are near the minimum/maximum.</param>
|
||||
/// <param name="middle">The middle of the sigmoid output.</param>
|
||||
/// <param name="height">The height of the sigmoid output. This will be equal to max value - min value.</param>
|
||||
public static double Sigmoid(double val, double center, double width, double middle, double height)
|
||||
{
|
||||
return Math.Tanh(Math.E * -(val - center) / width);
|
||||
}
|
||||
|
||||
private static double sigmoid(double val, double center, double width, double middle, double height)
|
||||
{
|
||||
return sigmoid(val, center, width) * (height / 2) + middle;
|
||||
double sigmoid = Math.Tanh(Math.E * -(val - center) / width);
|
||||
return sigmoid * (height / 2) + middle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -27,7 +31,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
||||
/// </summary>
|
||||
public static double EvaluateDifficultyOf(MonoEncoding encoding, int i)
|
||||
{
|
||||
return sigmoid(i, 2, 2, 0.5, 1);
|
||||
return Sigmoid(i, 2, 2, 0.5, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -37,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
||||
/// <param name="i">The index of the colour encoding within it's parent <see cref="CoupledColourEncoding"/>.</param>
|
||||
public static double EvaluateDifficultyOf(ColourEncoding encoding, int i)
|
||||
{
|
||||
return sigmoid(i, 2, 2, 0.5, 1);
|
||||
return Sigmoid(i, 2, 2, 0.5, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -45,7 +49,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
||||
/// </summary>
|
||||
public static double EvaluateDifficultyOf(CoupledColourEncoding encoding)
|
||||
{
|
||||
return 1 - sigmoid(encoding.RepetitionInterval, 2, 2, 0.5, 1);
|
||||
return 1 - Sigmoid(encoding.RepetitionInterval, 2, 2, 0.5, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -34,8 +34,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||
public int RepetitionInterval { get; private set; } = max_repetition_interval + 1;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if other is considered a repetition of this encoding. This is true if other's first two payload
|
||||
/// identical mono lengths.
|
||||
/// Returns true if other is considered a repetition of this encoding. This is true if other's first two payloads
|
||||
/// have identical mono lengths.
|
||||
/// </summary>
|
||||
private bool isRepetitionOf(CoupledColourEncoding other)
|
||||
{
|
||||
|
@ -16,7 +16,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||
/// <summary>
|
||||
/// List of <see cref="DifficultyHitObject"/>s that are encoded within this <see cref="MonoEncoding"/>.
|
||||
/// This is not declared as <see cref="TaikoDifficultyHitObject"/> to avoid circular dependencies.
|
||||
/// TODO: Review this, are circular dependencies within data-only classes are acceptable?
|
||||
/// </summary>
|
||||
public List<TaikoDifficultyHitObject> EncodedData { get; private set; } = new List<TaikoDifficultyHitObject>();
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
{
|
||||
private readonly IReadOnlyList<TaikoDifficultyHitObject>? monoDifficultyHitObjects;
|
||||
public readonly int MonoIndex;
|
||||
private readonly IReadOnlyList<TaikoDifficultyHitObject> noteObjects;
|
||||
private readonly IReadOnlyList<TaikoDifficultyHitObject> noteDifficultyHitObjects;
|
||||
public readonly int NoteIndex;
|
||||
|
||||
/// <summary>
|
||||
@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
: base(hitObject, lastObject, clockRate, objects, index)
|
||||
{
|
||||
var currentHit = hitObject as Hit;
|
||||
this.noteObjects = noteObjects;
|
||||
noteDifficultyHitObjects = noteObjects;
|
||||
|
||||
Rhythm = getClosestRhythm(lastObject, lastLastObject, clockRate);
|
||||
HitType? hitType = currentHit?.Type;
|
||||
@ -120,8 +120,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
|
||||
public TaikoDifficultyHitObject? NextMono(int forwardsIndex) => monoDifficultyHitObjects?.ElementAtOrDefault(MonoIndex + (forwardsIndex + 1));
|
||||
|
||||
public TaikoDifficultyHitObject? PreviousNote(int backwardsIndex) => noteObjects.ElementAtOrDefault(NoteIndex - (backwardsIndex + 1));
|
||||
public TaikoDifficultyHitObject? PreviousNote(int backwardsIndex) => noteDifficultyHitObjects.ElementAtOrDefault(NoteIndex - (backwardsIndex + 1));
|
||||
|
||||
public TaikoDifficultyHitObject? NextNote(int forwardsIndex) => noteObjects.ElementAtOrDefault(NoteIndex + (forwardsIndex + 1));
|
||||
public TaikoDifficultyHitObject? NextNote(int forwardsIndex) => noteDifficultyHitObjects.ElementAtOrDefault(NoteIndex + (forwardsIndex + 1));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user