mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Share sigmoid, Fix Preprocessor XML
This commit is contained in:
parent
08dd9c79db
commit
b7567f7db2
@ -25,21 +25,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluate the difficulty of the first note of a <see cref="MonoEncoding"/>.
|
||||
/// <param name="encoding">The encoding to evaluate.</param>
|
||||
/// <param name="i">The index of the mono encoding within it's parent <see cref="ColourEncoding"/>.</param>
|
||||
/// Evaluate the difficulty of the first note of a <see cref="MonoEncoding"/> or a <see cref="ColourEncoding"/>.
|
||||
/// <param name="i">The index of either encoding within it's respective parent.</param>
|
||||
/// </summary>
|
||||
public static double EvaluateDifficultyOf(MonoEncoding encoding, int i)
|
||||
{
|
||||
return Sigmoid(i, 2, 2, 0.5, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluate the difficulty of the first note of a <see cref="ColourEncoding"/>.
|
||||
/// </summary>
|
||||
/// <param name="encoding">The encoding to evaluate.</param>
|
||||
/// <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)
|
||||
public static double EvaluateDifficultyOf(int i)
|
||||
{
|
||||
return Sigmoid(i, 2, 2, 0.5, 1);
|
||||
}
|
||||
@ -65,13 +54,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
||||
for (int i = 0; i < encoding.Payload.Count; i++)
|
||||
{
|
||||
ColourEncoding colourEncoding = encoding.Payload[i];
|
||||
double colourEncodingDifficulty = EvaluateDifficultyOf(colourEncoding, i) * coupledEncodingDifficulty;
|
||||
double colourEncodingDifficulty = EvaluateDifficultyOf(i) * coupledEncodingDifficulty;
|
||||
colourEncoding.Payload[0].EncodedData[0].Colour!.EvaluatedDifficulty += colourEncodingDifficulty;
|
||||
|
||||
for (int j = 0; j < colourEncoding.Payload.Count; j++)
|
||||
{
|
||||
MonoEncoding monoEncoding = colourEncoding.Payload[j];
|
||||
monoEncoding.EncodedData[0].Colour!.EvaluatedDifficulty += EvaluateDifficultyOf(monoEncoding, j) * colourEncodingDifficulty * 0.5;
|
||||
monoEncoding.EncodedData[0].Colour!.EvaluatedDifficulty += EvaluateDifficultyOf(j) * colourEncodingDifficulty * 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
||||
public class TaikoColourDifficultyPreprocessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Process and encode a list of <see cref="TaikoDifficultyHitObject"/>s into a list of <see cref="TaikoDifficultyHitObjectColour"/>s,
|
||||
/// assign the appropriate <see cref="TaikoDifficultyHitObjectColour"/>s to each <see cref="TaikoDifficultyHitObject"/>,
|
||||
/// and preevaluate colour difficulty of each <see cref="TaikoDifficultyHitObject"/>.
|
||||
/// Processes and encodes a list of <see cref="TaikoDifficultyHitObject"/>s into a list of <see cref="TaikoDifficultyHitObjectColour"/>s,
|
||||
/// assigning the appropriate <see cref="TaikoDifficultyHitObjectColour"/>s to each <see cref="TaikoDifficultyHitObject"/>,
|
||||
/// and pre-evaluating colour difficulty of each <see cref="TaikoDifficultyHitObject"/>.
|
||||
/// </summary>
|
||||
public static List<TaikoDifficultyHitObjectColour> ProcessAndAssign(List<DifficultyHitObject> hitObjects)
|
||||
{
|
||||
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
||||
});
|
||||
});
|
||||
|
||||
// Preevaluate and assign difficulty values
|
||||
// Pre-evaluate and assign difficulty values
|
||||
ColourEvaluator.PreEvaluateDifficulties(coupledEncoding);
|
||||
});
|
||||
|
||||
@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
||||
// This ignores all non-note objects, which may or may not be the desired behaviour
|
||||
TaikoDifficultyHitObject? previousObject = taikoObject.PreviousNote(0);
|
||||
|
||||
// If the colour changed, or if this is the first object in the run, create a new mono encoding
|
||||
// If the colour changed or if this is the first object in the run, create a new mono encoding
|
||||
if
|
||||
(
|
||||
previousObject == null || // First object in the list
|
||||
@ -75,8 +75,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we're here, we're in the same encoding as the previous object, thus lastEncoded is not null. Add
|
||||
// the current object to the encoded payload.
|
||||
// If we're here, we're in the same encoding as the previous object, thus lastEncoded is not null.
|
||||
// Add the current object to the encoded payload.
|
||||
lastEncoded!.EncodedData.Add(taikoObject);
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
||||
isCoupled = i < data.Count - 2 && data[i].IsRepetitionOf(data[i + 2]);
|
||||
}
|
||||
|
||||
// Skip over peeked data and add the rest to the payload
|
||||
// Skip over viewed data and add the rest to the payload
|
||||
lastEncoded.Payload.Add(data[i]);
|
||||
lastEncoded.Payload.Add(data[i + 1]);
|
||||
i++;
|
||||
|
Loading…
Reference in New Issue
Block a user