Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix standard ruleset accuracy calculation on Lazer #229

Merged
merged 2 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PerformanceCalculator/Simulate/CatchSimulateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected override Dictionary<HitResult, int> GenerateHitResults(double accuracy
};
}

protected override double GetAccuracy(Dictionary<HitResult, int> statistics)
protected override double GetAccuracy(IBeatmap beatmap, Dictionary<HitResult, int> statistics)
{
double hits = statistics[HitResult.Great] + statistics[HitResult.LargeTickHit] + statistics[HitResult.SmallTickHit];
double total = hits + statistics[HitResult.Miss] + statistics[HitResult.SmallTickMiss];
Expand Down
12 changes: 9 additions & 3 deletions PerformanceCalculator/Simulate/OsuSimulateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,21 @@ protected override Dictionary<HitResult, int> GenerateHitResults(double accuracy
};
}

protected override double GetAccuracy(Dictionary<HitResult, int> statistics)
protected override double GetAccuracy(IBeatmap beatmap, Dictionary<HitResult, int> statistics)
{
var countGreat = statistics[HitResult.Great];
var countGood = statistics[HitResult.Ok];
var countMeh = statistics[HitResult.Meh];
var countMiss = statistics[HitResult.Miss];
var total = countGreat + countGood + countMeh + countMiss;

return (double)((6 * countGreat) + (2 * countGood) + countMeh) / (6 * total);
var countSliders = beatmap.HitObjects.Count(x => x is Slider);
var countSliderTailHit = statistics[HitResult.SliderTailHit];
var countLargeTicks = beatmap.HitObjects.Sum(obj => obj.NestedHitObjects.Count(x => x is SliderTick or SliderRepeat));
var countLargeTickHit = countLargeTicks - statistics[HitResult.LargeTickMiss];

double total = 6 * (countGreat + countGood + countMeh + countMiss) + 3 * countSliders + 0.6 * countLargeTicks;

return (6 * countGreat + 2 * countGood + countMeh + 3 * countSliderTailHit + 0.6 * countLargeTickHit) / total;
}
}
}
4 changes: 2 additions & 2 deletions PerformanceCalculator/Simulate/SimulateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public override void Execute()
var statistics = GenerateHitResults(Accuracy / 100, beatmap, Misses, Mehs, Goods);
var scoreInfo = new ScoreInfo(beatmap.BeatmapInfo, ruleset.RulesetInfo)
{
Accuracy = GetAccuracy(statistics),
Accuracy = GetAccuracy(beatmap, statistics),
MaxCombo = Combo ?? (int)Math.Round(PercentCombo / 100 * beatmapMaxCombo),
Statistics = statistics,
Mods = mods
Expand All @@ -85,6 +85,6 @@ public override void Execute()

protected abstract Dictionary<HitResult, int> GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood);

protected virtual double GetAccuracy(Dictionary<HitResult, int> statistics) => 0;
protected virtual double GetAccuracy(IBeatmap beatmap, Dictionary<HitResult, int> statistics) => 0;
}
}
2 changes: 1 addition & 1 deletion PerformanceCalculator/Simulate/TaikoSimulateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected override Dictionary<HitResult, int> GenerateHitResults(double accuracy
};
}

protected override double GetAccuracy(Dictionary<HitResult, int> statistics)
protected override double GetAccuracy(IBeatmap beatmap, Dictionary<HitResult, int> statistics)
{
var countGreat = statistics[HitResult.Great];
var countGood = statistics[HitResult.Ok];
Expand Down
Loading