mirror of
https://github.com/ppy/osu.git
synced 2025-02-26 09:33:13 +08:00
Codequality parse
This commit is contained in:
parent
45c055bfa1
commit
7e3f62a5a5
@ -1,12 +1,15 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
||||||
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour;
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour;
|
||||||
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
||||||
{
|
{
|
||||||
public class ColourEvaluator
|
public class ColourEvaluator
|
||||||
{
|
{
|
||||||
// TODO - Share this sigmoid
|
|
||||||
private static double sigmoid(double val, double center, double width)
|
private static double sigmoid(double val, double center, double width)
|
||||||
{
|
{
|
||||||
return Math.Tanh(Math.E * -(val - center) / width);
|
return Math.Tanh(Math.E * -(val - center) / width);
|
||||||
@ -54,11 +57,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
|||||||
{
|
{
|
||||||
double coupledEncodingDifficulty = 2 * EvaluateDifficultyOf(encoding);
|
double coupledEncodingDifficulty = 2 * EvaluateDifficultyOf(encoding);
|
||||||
encoding.Payload[0].Payload[0].EncodedData[0].Colour!.EvaluatedDifficulty += coupledEncodingDifficulty;
|
encoding.Payload[0].Payload[0].EncodedData[0].Colour!.EvaluatedDifficulty += coupledEncodingDifficulty;
|
||||||
|
|
||||||
for (int i = 0; i < encoding.Payload.Count; i++)
|
for (int i = 0; i < encoding.Payload.Count; i++)
|
||||||
{
|
{
|
||||||
ColourEncoding colourEncoding = encoding.Payload[i];
|
ColourEncoding colourEncoding = encoding.Payload[i];
|
||||||
double colourEncodingDifficulty = EvaluateDifficultyOf(colourEncoding, i) * coupledEncodingDifficulty;
|
double colourEncodingDifficulty = EvaluateDifficultyOf(colourEncoding, i) * coupledEncodingDifficulty;
|
||||||
colourEncoding.Payload[0].EncodedData[0].Colour!.EvaluatedDifficulty += colourEncodingDifficulty;
|
colourEncoding.Payload[0].EncodedData[0].Colour!.EvaluatedDifficulty += colourEncodingDifficulty;
|
||||||
|
|
||||||
for (int j = 0; j < colourEncoding.Payload.Count; j++)
|
for (int j = 0; j < colourEncoding.Payload.Count; j++)
|
||||||
{
|
{
|
||||||
MonoEncoding monoEncoding = colourEncoding.Payload[j];
|
MonoEncoding monoEncoding = colourEncoding.Payload[j];
|
||||||
|
@ -22,8 +22,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
|||||||
// be removed when that is implemented.
|
// be removed when that is implemented.
|
||||||
interval = Math.Max(interval, 100);
|
interval = Math.Max(interval, 100);
|
||||||
|
|
||||||
// return 15 / Math.Pow(interval, 0.6);
|
|
||||||
// return Math.Pow(0.2, interval / 1000);
|
|
||||||
return 30 / interval;
|
return 30 / interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,14 +31,14 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static double EvaluateDifficultyOf(DifficultyHitObject current)
|
public static double EvaluateDifficultyOf(DifficultyHitObject current)
|
||||||
{
|
{
|
||||||
if (!(current.BaseObject is Hit))
|
if (current.BaseObject is not Hit)
|
||||||
{
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the previous hit object hit by the current key, which is two notes of the same colour prior.
|
// Find the previous hit object hit by the current key, which is two notes of the same colour prior.
|
||||||
TaikoDifficultyHitObject taikoCurrent = (TaikoDifficultyHitObject)current;
|
TaikoDifficultyHitObject taikoCurrent = (TaikoDifficultyHitObject)current;
|
||||||
TaikoDifficultyHitObject keyPrevious = taikoCurrent.PreviousMono(1);
|
TaikoDifficultyHitObject? keyPrevious = taikoCurrent.PreviousMono(1);
|
||||||
|
|
||||||
if (keyPrevious == null)
|
if (keyPrevious == null)
|
||||||
{
|
{
|
||||||
@ -49,7 +47,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
|||||||
}
|
}
|
||||||
|
|
||||||
double objectStrain = 0.5; // Add a base strain to all objects
|
double objectStrain = 0.5; // Add a base strain to all objects
|
||||||
// double objectStrain = 0;
|
|
||||||
objectStrain += speedBonus(taikoCurrent.StartTime - keyPrevious.StartTime);
|
objectStrain += speedBonus(taikoCurrent.StartTime - keyPrevious.StartTime);
|
||||||
return objectStrain;
|
return objectStrain;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Encodes a list of <see cref="MonoEncoding"/>s.
|
/// Encodes a list of <see cref="MonoEncoding"/>s.
|
||||||
@ -19,20 +22,20 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
/// is a strict comparison and is true if and only if the colour sequence is exactly the same.
|
/// is a strict comparison and is true if and only if the colour sequence is exactly the same.
|
||||||
/// This does not require the <see cref="ColourEncoding"/>s to have the same amount of <see cref="MonoEncoding"/>s.
|
/// This does not require the <see cref="ColourEncoding"/>s to have the same amount of <see cref="MonoEncoding"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool isRepetitionOf(ColourEncoding other)
|
public bool IsRepetitionOf(ColourEncoding other)
|
||||||
{
|
{
|
||||||
return hasIdenticalMonoLength(other) &&
|
return HasIdenticalMonoLength(other) &&
|
||||||
other.Payload.Count == Payload.Count &&
|
other.Payload.Count == Payload.Count &&
|
||||||
(other.Payload[0].EncodedData[0].BaseObject as Hit)?.Type ==
|
(other.Payload[0].EncodedData[0].BaseObject as Hit)?.Type ==
|
||||||
(Payload[0].EncodedData[0].BaseObject as Hit)?.Type;
|
(Payload[0].EncodedData[0].BaseObject as Hit)?.Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determine if this <see cref="ColourEncoding"/> has the same mono length of another <see cref="ColourEncoding"/>.
|
/// Determine if this <see cref="ColourEncoding"/> has the same mono length of another <see cref="ColourEncoding"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool hasIdenticalMonoLength(ColourEncoding other)
|
public bool HasIdenticalMonoLength(ColourEncoding other)
|
||||||
{
|
{
|
||||||
return other.Payload[0].RunLength == Payload[0].RunLength;
|
return other.Payload[0].RunLength == Payload[0].RunLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,13 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Encodes a list of <see cref="ColourEncoding"/>s, grouped together by back and forth repetition of the same
|
/// Encodes a list of <see cref="ColourEncoding"/>s, grouped together by back and forth repetition of the same
|
||||||
/// <see cref="ColourEncoding"/>. Also stores the repetition interval between this and the previous <see cref="CoupledColourEncoding"/>.
|
/// <see cref="ColourEncoding"/>. Also stores the repetition interval between this and the previous <see cref="CoupledColourEncoding"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CoupledColourEncoding
|
public class CoupledColourEncoding
|
||||||
@ -34,13 +37,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
/// Returns true if other is considered a repetition of this encoding. This is true if other's first two payload
|
/// Returns true if other is considered a repetition of this encoding. This is true if other's first two payload
|
||||||
/// identical mono lengths.
|
/// identical mono lengths.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool isRepetitionOf(CoupledColourEncoding other)
|
private bool isRepetitionOf(CoupledColourEncoding other)
|
||||||
{
|
{
|
||||||
if (this.Payload.Count != other.Payload.Count) return false;
|
if (Payload.Count != other.Payload.Count) return false;
|
||||||
|
|
||||||
for (int i = 0; i < Math.Min(this.Payload.Count, 2); i++)
|
for (int i = 0; i < Math.Min(Payload.Count, 2); i++)
|
||||||
{
|
{
|
||||||
if (!this.Payload[i].hasIdenticalMonoLength(other.Payload[i])) return false;
|
if (!Payload[i].HasIdenticalMonoLength(other.Payload[i])) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -60,9 +63,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
|
|
||||||
CoupledColourEncoding? other = Previous.Previous;
|
CoupledColourEncoding? other = Previous.Previous;
|
||||||
int interval = 2;
|
int interval = 2;
|
||||||
|
|
||||||
while (interval < max_repetition_interval)
|
while (interval < max_repetition_interval)
|
||||||
{
|
{
|
||||||
if (this.isRepetitionOf(other))
|
if (isRepetitionOf(other))
|
||||||
{
|
{
|
||||||
RepetitionInterval = Math.Min(interval, max_repetition_interval);
|
RepetitionInterval = Math.Min(interval, max_repetition_interval);
|
||||||
return;
|
return;
|
||||||
@ -70,10 +74,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
|
|
||||||
other = other.Previous;
|
other = other.Previous;
|
||||||
if (other == null) break;
|
if (other == null) break;
|
||||||
|
|
||||||
++interval;
|
++interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
RepetitionInterval = max_repetition_interval + 1;
|
RepetitionInterval = max_repetition_interval + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,11 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Encode colour information for a sequence of <see cref="TaikoDifficultyHitObject"/>s. Consecutive <see cref="TaikoDifficultyHitObject"/>s
|
/// Encode colour information for a sequence of <see cref="TaikoDifficultyHitObject"/>s. Consecutive <see cref="TaikoDifficultyHitObject"/>s
|
||||||
@ -19,4 +22,4 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
|
|
||||||
public int RunLength => EncodedData.Count;
|
public int RunLength => EncodedData.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,10 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||||
using osu.Game.Rulesets.Taiko.Difficulty.Evaluators;
|
using osu.Game.Rulesets.Taiko.Difficulty.Evaluators;
|
||||||
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
||||||
@ -50,16 +54,20 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
List<MonoEncoding> encoded = new List<MonoEncoding>();
|
List<MonoEncoding> encoded = new List<MonoEncoding>();
|
||||||
|
|
||||||
MonoEncoding? lastEncoded = null;
|
MonoEncoding? lastEncoded = null;
|
||||||
|
|
||||||
for (int i = 0; i < data.Count; i++)
|
for (int i = 0; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
TaikoDifficultyHitObject taikoObject = (TaikoDifficultyHitObject)data[i];
|
TaikoDifficultyHitObject taikoObject = (TaikoDifficultyHitObject)data[i];
|
||||||
// This ignores all non-note objects, which may or may not be the desired behaviour
|
// This ignores all non-note objects, which may or may not be the desired behaviour
|
||||||
TaikoDifficultyHitObject previousObject = taikoObject.PreviousNote(0);
|
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 (
|
if
|
||||||
|
(
|
||||||
previousObject == null || // First object in the list
|
previousObject == null || // First object in the list
|
||||||
(taikoObject.BaseObject as Hit)?.Type != (previousObject.BaseObject as Hit)?.Type)
|
(taikoObject.BaseObject as Hit)?.Type != (previousObject.BaseObject as Hit)?.Type
|
||||||
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
lastEncoded = new MonoEncoding();
|
lastEncoded = new MonoEncoding();
|
||||||
lastEncoded.EncodedData.Add(taikoObject);
|
lastEncoded.EncodedData.Add(taikoObject);
|
||||||
@ -82,6 +90,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
{
|
{
|
||||||
List<ColourEncoding> encoded = new List<ColourEncoding>();
|
List<ColourEncoding> encoded = new List<ColourEncoding>();
|
||||||
ColourEncoding? lastEncoded = null;
|
ColourEncoding? lastEncoded = null;
|
||||||
|
|
||||||
for (int i = 0; i < data.Count; i++)
|
for (int i = 0; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
// Starts a new ColourEncoding if the previous MonoEncoding has a different mono length, or if this is
|
// Starts a new ColourEncoding if the previous MonoEncoding has a different mono length, or if this is
|
||||||
@ -121,17 +130,19 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
{
|
{
|
||||||
List<CoupledColourEncoding> encoded = new List<CoupledColourEncoding>();
|
List<CoupledColourEncoding> encoded = new List<CoupledColourEncoding>();
|
||||||
CoupledColourEncoding? lastEncoded = null;
|
CoupledColourEncoding? lastEncoded = null;
|
||||||
|
|
||||||
for (int i = 0; i < data.Count; i++)
|
for (int i = 0; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
// Starts a new CoupledColourEncoding. ColourEncodings that should be grouped together will be handled
|
// Starts a new CoupledColourEncoding. ColourEncodings that should be grouped together will be handled
|
||||||
// later within this loop.
|
// later within this loop.
|
||||||
lastEncoded = new CoupledColourEncoding()
|
lastEncoded = new CoupledColourEncoding
|
||||||
{
|
{
|
||||||
Previous = lastEncoded
|
Previous = lastEncoded
|
||||||
};
|
};
|
||||||
|
|
||||||
// Determine if future ColourEncodings should be grouped.
|
// Determine if future ColourEncodings should be grouped.
|
||||||
bool isCoupled = i < data.Count - 2 && data[i].isRepetitionOf(data[i + 2]);
|
bool isCoupled = i < data.Count - 2 && data[i].IsRepetitionOf(data[i + 2]);
|
||||||
|
|
||||||
if (!isCoupled)
|
if (!isCoupled)
|
||||||
{
|
{
|
||||||
// If not, add the current ColourEncoding to the encoded payload and continue.
|
// If not, add the current ColourEncoding to the encoded payload and continue.
|
||||||
@ -139,14 +150,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If so, add the current ColourEncoding to the encoded payload and start repeatedly checking if
|
// If so, add the current ColourEncoding to the encoded payload and start repeatedly checking if the
|
||||||
// subsequent ColourEncodings should be grouped by increasing i and doing the appropriate isCoupled
|
// subsequent ColourEncodings should be grouped by increasing i and doing the appropriate isCoupled check.
|
||||||
// check;
|
|
||||||
while (isCoupled)
|
while (isCoupled)
|
||||||
{
|
{
|
||||||
lastEncoded.Payload.Add(data[i]);
|
lastEncoded.Payload.Add(data[i]);
|
||||||
i++;
|
i++;
|
||||||
isCoupled = i < data.Count - 2 && data[i].isRepetitionOf(data[i + 2]);
|
isCoupled = i < data.Count - 2 && data[i].IsRepetitionOf(data[i + 2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip over peeked data and add the rest to the payload
|
// Skip over peeked data and add the rest to the payload
|
||||||
@ -167,4 +177,4 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
return encoded;
|
return encoded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -6,7 +11,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class TaikoDifficultyHitObjectColour
|
public class TaikoDifficultyHitObjectColour
|
||||||
{
|
{
|
||||||
public CoupledColourEncoding Encoding { get; private set; }
|
public CoupledColourEncoding Encoding { get; }
|
||||||
|
|
||||||
public double EvaluatedDifficulty = 0;
|
public double EvaluatedDifficulty = 0;
|
||||||
|
|
||||||
@ -15,4 +20,4 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
Encoding = encoding;
|
Encoding = encoding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Rhythm
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -47,10 +47,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
|||||||
/// <param name="noteObjects">The list of <see cref="DifficultyHitObject"/>s that is a hit (i.e. not a slider or spinner) in the current beatmap.</param>
|
/// <param name="noteObjects">The list of <see cref="DifficultyHitObject"/>s that is a hit (i.e. not a slider or spinner) in the current beatmap.</param>
|
||||||
/// <param name="index">The position of this <see cref="DifficultyHitObject"/> in the <paramref name="objects"/> list.</param>
|
/// <param name="index">The position of this <see cref="DifficultyHitObject"/> in the <paramref name="objects"/> list.</param>
|
||||||
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate,
|
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate,
|
||||||
List<DifficultyHitObject> objects,
|
List<DifficultyHitObject> objects,
|
||||||
List<TaikoDifficultyHitObject> centreHitObjects,
|
List<TaikoDifficultyHitObject> centreHitObjects,
|
||||||
List<TaikoDifficultyHitObject> rimHitObjects,
|
List<TaikoDifficultyHitObject> rimHitObjects,
|
||||||
List<TaikoDifficultyHitObject> noteObjects, int index)
|
List<TaikoDifficultyHitObject> noteObjects, int index)
|
||||||
: base(hitObject, lastObject, clockRate, objects, index)
|
: base(hitObject, lastObject, clockRate, objects, index)
|
||||||
{
|
{
|
||||||
var currentHit = hitObject as Hit;
|
var currentHit = hitObject as Hit;
|
||||||
@ -59,13 +59,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
|||||||
Rhythm = getClosestRhythm(lastObject, lastLastObject, clockRate);
|
Rhythm = getClosestRhythm(lastObject, lastLastObject, clockRate);
|
||||||
HitType? hitType = currentHit?.Type;
|
HitType? hitType = currentHit?.Type;
|
||||||
|
|
||||||
if (hitType == Objects.HitType.Centre)
|
if (hitType == HitType.Centre)
|
||||||
{
|
{
|
||||||
MonoIndex = centreHitObjects.Count;
|
MonoIndex = centreHitObjects.Count;
|
||||||
centreHitObjects.Add(this);
|
centreHitObjects.Add(this);
|
||||||
monoDifficultyHitObjects = centreHitObjects;
|
monoDifficultyHitObjects = centreHitObjects;
|
||||||
}
|
}
|
||||||
else if (hitType == Objects.HitType.Rim)
|
else if (hitType == HitType.Rim)
|
||||||
{
|
{
|
||||||
MonoIndex = rimHitObjects.Count;
|
MonoIndex = rimHitObjects.Count;
|
||||||
rimHitObjects.Add(this);
|
rimHitObjects.Add(this);
|
||||||
@ -116,12 +116,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
|||||||
return common_rhythms.OrderBy(x => Math.Abs(x.Ratio - ratio)).First();
|
return common_rhythms.OrderBy(x => Math.Abs(x.Ratio - ratio)).First();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaikoDifficultyHitObject PreviousMono(int backwardsIndex) => monoDifficultyHitObjects.ElementAtOrDefault(MonoIndex - (backwardsIndex + 1));
|
public TaikoDifficultyHitObject? PreviousMono(int backwardsIndex) => monoDifficultyHitObjects?.ElementAtOrDefault(MonoIndex - (backwardsIndex + 1));
|
||||||
|
|
||||||
public TaikoDifficultyHitObject NextMono(int forwardsIndex) => monoDifficultyHitObjects.ElementAtOrDefault(MonoIndex + (forwardsIndex + 1));
|
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) => noteObjects.ElementAtOrDefault(NoteIndex - (backwardsIndex + 1));
|
||||||
|
|
||||||
public TaikoDifficultyHitObject NextNote(int forwardsIndex) => noteObjects.ElementAtOrDefault(NoteIndex + (forwardsIndex + 1));
|
public TaikoDifficultyHitObject? NextNote(int forwardsIndex) => noteObjects.ElementAtOrDefault(NoteIndex + (forwardsIndex + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -30,9 +33,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
|||||||
centreObjects, rimObjects, noteObjects, difficultyHitObjects.Count)
|
centreObjects, rimObjects, noteObjects, difficultyHitObjects.Count)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
var encoded = TaikoColourDifficultyPreprocessor.ProcessAndAssign(difficultyHitObjects);
|
|
||||||
|
TaikoColourDifficultyPreprocessor.ProcessAndAssign(difficultyHitObjects);
|
||||||
|
|
||||||
return difficultyHitObjects;
|
return difficultyHitObjects;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
#nullable disable
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||||
using osu.Game.Rulesets.Difficulty.Skills;
|
using osu.Game.Rulesets.Difficulty.Skills;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
||||||
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
||||||
{
|
{
|
||||||
@ -33,34 +32,5 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|||||||
double difficulty = ((TaikoDifficultyHitObject)current).Colour?.EvaluatedDifficulty ?? 0;
|
double difficulty = ((TaikoDifficultyHitObject)current).Colour?.EvaluatedDifficulty ?? 0;
|
||||||
return difficulty;
|
return difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove before pr
|
|
||||||
public static String GetDebugHeaderLabels()
|
|
||||||
{
|
|
||||||
return "StartTime,Raw,Decayed,CoupledRunLength,RepetitionInterval,EncodingRunLength,Payload(MonoRunLength|MonoCount)";
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Remove before pr
|
|
||||||
public string GetDebugString(DifficultyHitObject current)
|
|
||||||
{
|
|
||||||
double difficulty = ((TaikoDifficultyHitObject)current).Colour?.EvaluatedDifficulty ?? 0;
|
|
||||||
TaikoDifficultyHitObject? taikoCurrent = (TaikoDifficultyHitObject)current;
|
|
||||||
TaikoDifficultyHitObjectColour? colour = taikoCurrent?.Colour;
|
|
||||||
if (taikoCurrent != null && colour != null)
|
|
||||||
{
|
|
||||||
List<ColourEncoding> payload = colour.Encoding.Payload;
|
|
||||||
string payloadDisplay = "";
|
|
||||||
for (int i = 0; i < payload.Count; ++i)
|
|
||||||
{
|
|
||||||
payloadDisplay += $"({payload[i].Payload[0].RunLength}|{payload[i].Payload.Count})";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $"{current.StartTime},{difficulty},{CurrentStrain},{colour.Encoding.Payload[0].Payload.Count},{colour.Encoding.RepetitionInterval},{colour.Encoding.Payload.Count},{payloadDisplay}";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return $"{current.StartTime},{difficulty},{CurrentStrain},0,0,0,0,0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||||
using osu.Game.Rulesets.Difficulty.Skills;
|
using osu.Game.Rulesets.Difficulty.Skills;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
||||||
{
|
{
|
||||||
@ -25,33 +28,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|||||||
public double RhythmDifficultyValue => rhythm.DifficultyValue() * rhythm_skill_multiplier;
|
public double RhythmDifficultyValue => rhythm.DifficultyValue() * rhythm_skill_multiplier;
|
||||||
public double StaminaDifficultyValue => stamina.DifficultyValue() * stamina_skill_multiplier;
|
public double StaminaDifficultyValue => stamina.DifficultyValue() * stamina_skill_multiplier;
|
||||||
|
|
||||||
// TODO: remove before pr
|
public Peaks(Mod[] mods)
|
||||||
private StreamWriter? colourDebugOutput;
|
|
||||||
bool debugColour = false;
|
|
||||||
private StreamWriter? strainPeakDebugOutput;
|
|
||||||
bool debugStrain = false;
|
|
||||||
|
|
||||||
public Peaks(Mod[] mods, IBeatmap beatmap)
|
|
||||||
: base(mods)
|
: base(mods)
|
||||||
{
|
{
|
||||||
rhythm = new Rhythm(mods);
|
rhythm = new Rhythm(mods);
|
||||||
colour = new Colour(mods);
|
colour = new Colour(mods);
|
||||||
stamina = new Stamina(mods);
|
stamina = new Stamina(mods);
|
||||||
|
|
||||||
if (debugColour)
|
|
||||||
{
|
|
||||||
String filename = $"{beatmap.BeatmapInfo.OnlineID} - {beatmap.BeatmapInfo.Metadata.Title}[{beatmap.BeatmapInfo.DifficultyName}].csv";
|
|
||||||
filename = filename.Replace('/', '_');
|
|
||||||
colourDebugOutput = new StreamWriter(File.OpenWrite($"/run/mount/secondary/workspace/osu/output/colour-debug/{filename}"));
|
|
||||||
colourDebugOutput.WriteLine(Colour.GetDebugHeaderLabels());
|
|
||||||
}
|
|
||||||
if (debugStrain)
|
|
||||||
{
|
|
||||||
String filename = $"{beatmap.BeatmapInfo.OnlineID} - {beatmap.BeatmapInfo.Metadata.Title}[{beatmap.BeatmapInfo.DifficultyName}].csv";
|
|
||||||
filename = filename.Replace('/', '_');
|
|
||||||
strainPeakDebugOutput = new StreamWriter(File.OpenWrite($"/run/mount/secondary/workspace/osu/output/strain-debug/{filename}"));
|
|
||||||
strainPeakDebugOutput.WriteLine("Colour,Stamina,Rhythm,Combined");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -66,12 +48,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|||||||
rhythm.Process(current);
|
rhythm.Process(current);
|
||||||
colour.Process(current);
|
colour.Process(current);
|
||||||
stamina.Process(current);
|
stamina.Process(current);
|
||||||
|
|
||||||
// if (debugColour && colourDebugOutput != null)
|
|
||||||
// {
|
|
||||||
// colourDebugOutput.WriteLine(colour.GetDebugString(current));
|
|
||||||
// colourDebugOutput.Flush();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -98,11 +74,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
|||||||
double peak = norm(1.5, colourPeak, staminaPeak);
|
double peak = norm(1.5, colourPeak, staminaPeak);
|
||||||
peak = norm(2, peak, rhythmPeak);
|
peak = norm(2, peak, rhythmPeak);
|
||||||
|
|
||||||
if (debugStrain && strainPeakDebugOutput != null)
|
|
||||||
{
|
|
||||||
strainPeakDebugOutput.WriteLine($"{colourPeak},{staminaPeak},{rhythmPeak},{peak}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sections with 0 strain are excluded to avoid worst-case time complexity of the following sort (e.g. /b/2351871).
|
// Sections with 0 strain are excluded to avoid worst-case time complexity of the following sort (e.g. /b/2351871).
|
||||||
// These sections will not contribute to the difficulty.
|
// These sections will not contribute to the difficulty.
|
||||||
if (peak > 0)
|
if (peak > 0)
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
|||||||
{
|
{
|
||||||
return new Skill[]
|
return new Skill[]
|
||||||
{
|
{
|
||||||
new Peaks(mods, beatmap)
|
new Peaks(mods)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user