stick to f64::powi (/b/1005851+FL)

This commit is contained in:
MaxOhn
2024-02-14 18:07:28 +01:00
parent c1cd15d0d0
commit e772b056bf
6 changed files with 16 additions and 18 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ pub fn difficulty(
let base_speed_performance = (5.0 * (speed_rating / 0.0675).max(1.0) - 4.0).powi(3) / 100_000.0; let base_speed_performance = (5.0 * (speed_rating / 0.0675).max(1.0) - 4.0).powi(3) / 100_000.0;
let base_flashlight_performance = if mods.fl() { let base_flashlight_performance = if mods.fl() {
(flashlight_rating * flashlight_rating) * 25.0 flashlight_rating.powi(2) * 25.0
} else { } else {
0.0 0.0
}; };
+7 -7
View File
@@ -188,9 +188,9 @@ impl AimEvaluator {
// * The maximum velocity we buff is equal to 125 / strainTime // * The maximum velocity we buff is equal to 125 / strainTime
* angle_bonus.min(125.0 / osu_curr_obj.strain_time) * angle_bonus.min(125.0 / osu_curr_obj.strain_time)
// * scale buff from 150 bpm 1/4 to 200 bpm 1/4 // * scale buff from 150 bpm 1/4 to 200 bpm 1/4
* (base1 * base1) * base1.powi(2)
// * Buff distance exceeding 50 (radius) up to 100 (diameter). // * Buff distance exceeding 50 (radius) up to 100 (diameter).
* (base2 * base2); * base2.powi(2);
} }
// * Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute. // * Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute.
@@ -216,7 +216,7 @@ impl AimEvaluator {
// * Scale with ratio of difference compared to 0.5 * max dist. // * Scale with ratio of difference compared to 0.5 * max dist.
let dist_ratio_base = let dist_ratio_base =
(FRAC_PI_2 * (prev_vel - curr_vel).abs() / prev_vel.max(curr_vel)).sin(); (FRAC_PI_2 * (prev_vel - curr_vel).abs() / prev_vel.max(curr_vel)).sin();
let dist_ratio = dist_ratio_base * dist_ratio_base; let dist_ratio = dist_ratio_base.powi(2);
// * Reward for % distance up to 125 / strainTime for overlaps where velocity is still changing. // * Reward for % distance up to 125 / strainTime for overlaps where velocity is still changing.
let overlap_vel_buff = (125.0 / osu_curr_obj.strain_time.min(osu_last_obj.strain_time)) let overlap_vel_buff = (125.0 / osu_curr_obj.strain_time.min(osu_last_obj.strain_time))
@@ -227,7 +227,7 @@ impl AimEvaluator {
// * Penalize for rhythm changes. // * Penalize for rhythm changes.
let bonus_base = (osu_curr_obj.strain_time).min(osu_last_obj.strain_time) let bonus_base = (osu_curr_obj.strain_time).min(osu_last_obj.strain_time)
/ (osu_curr_obj.strain_time).max(osu_last_obj.strain_time); / (osu_curr_obj.strain_time).max(osu_last_obj.strain_time);
vel_change_bonus *= bonus_base * bonus_base; vel_change_bonus *= bonus_base.powi(2);
} }
if osu_last_obj.base.is_slider() { if osu_last_obj.base.is_slider() {
@@ -250,9 +250,9 @@ impl AimEvaluator {
} }
fn calc_wide_angle_bonus(angle: f64) -> f64 { fn calc_wide_angle_bonus(angle: f64) -> f64 {
let base = (3.0 / 4.0 * ((5.0 / 6.0 * PI).min(angle.max(PI / 6.0)) - PI / 6.0)).sin(); (3.0 / 4.0 * ((5.0 / 6.0 * PI).min(angle.max(PI / 6.0)) - PI / 6.0))
.sin()
base * base .powi(2)
} }
fn calc_acute_angle_bonus(angle: f64) -> f64 { fn calc_acute_angle_bonus(angle: f64) -> f64 {
+1 -2
View File
@@ -190,8 +190,7 @@ impl FlashlightEvaluator {
last_obj = curr_obj; last_obj = curr_obj;
} }
let base = small_dist_nerf * result; result = (small_dist_nerf * result).powi(2);
result = base * base;
// * Additional bonus for Hidden due to there being no approach circles. // * Additional bonus for Hidden due to there being no approach circles.
if hidden { if hidden {
+3 -4
View File
@@ -155,8 +155,7 @@ impl SpeedEvaluator {
let next_delta_time = osu_next_obj.delta_time.max(1.0); let next_delta_time = osu_next_obj.delta_time.max(1.0);
let delta_diff = (next_delta_time - curr_delta_time).abs(); let delta_diff = (next_delta_time - curr_delta_time).abs();
let speed_ratio = curr_delta_time / curr_delta_time.max(delta_diff); let speed_ratio = curr_delta_time / curr_delta_time.max(delta_diff);
let window_ratio_base = (curr_delta_time / hit_window).min(1.0); let window_ratio = (curr_delta_time / hit_window).min(1.0).powi(2);
let window_ratio = window_ratio_base * window_ratio_base;
doubletapness = speed_ratio.powf(1.0 - window_ratio); doubletapness = speed_ratio.powf(1.0 - window_ratio);
} }
@@ -168,7 +167,7 @@ impl SpeedEvaluator {
let speed_bonus = if strain_time < Self::MIN_SPEED_BONUS { let speed_bonus = if strain_time < Self::MIN_SPEED_BONUS {
let base = (Self::MIN_SPEED_BONUS - strain_time) / Self::SPEED_BALANCING_FACTOR; let base = (Self::MIN_SPEED_BONUS - strain_time) / Self::SPEED_BALANCING_FACTOR;
1.0 + 0.75 * (base * base) 1.0 + 0.75 * base.powi(2)
} else { } else {
1.0 1.0
}; };
@@ -246,7 +245,7 @@ impl RhythmEvaluator {
// * fancy function to calculate rhythmbonuses. // * fancy function to calculate rhythmbonuses.
let base = (PI / (prev_delta.min(curr_delta) / prev_delta.max(curr_delta))).sin(); let base = (PI / (prev_delta.min(curr_delta) / prev_delta.max(curr_delta))).sin();
let curr_ratio = 1.0 + 6.0 * (base * base).min(0.5); let curr_ratio = 1.0 + 6.0 * base.powi(2).min(0.5);
let hit_window = u64::from(!curr_obj.base.is_spinner()) as f64 * hit_window; let hit_window = u64::from(!curr_obj.base.is_spinner()) as f64 * hit_window;
+3 -3
View File
@@ -635,7 +635,7 @@ impl OsuPerformanceInner {
aim_value *= self.acc; aim_value *= self.acc;
// * It is important to consider accuracy difficulty when scaling with accuracy. // * It is important to consider accuracy difficulty when scaling with accuracy.
aim_value *= 0.98 + self.attrs.od * self.attrs.od / 2500.0; aim_value *= 0.98 + self.attrs.od.powi(2) / 2500.0;
aim_value aim_value
} }
@@ -760,7 +760,7 @@ impl OsuPerformanceInner {
return 0.0; return 0.0;
} }
let mut flashlight_value = self.attrs.flashlight * self.attrs.flashlight * 25.0; let mut flashlight_value = self.attrs.flashlight.powi(2) * 25.0;
let total_hits = self.total_hits(); let total_hits = self.total_hits();
@@ -783,7 +783,7 @@ impl OsuPerformanceInner {
// * Scale the flashlight value with accuracy _slightly_. // * Scale the flashlight value with accuracy _slightly_.
flashlight_value *= 0.5 + self.acc / 2.0; flashlight_value *= 0.5 + self.acc / 2.0;
// * It is important to also consider accuracy difficulty when doing that. // * It is important to also consider accuracy difficulty when doing that.
flashlight_value *= 0.98 + self.attrs.od * self.attrs.od / 2500.0; flashlight_value *= 0.98 + self.attrs.od.powi(2) / 2500.0;
flashlight_value flashlight_value
} }
+1 -1
View File
@@ -464,7 +464,7 @@ impl TaikoPerformanceInner {
let acc = self.custom_accuracy(); let acc = self.custom_accuracy();
diff_value * acc * acc diff_value * acc.powi(2)
} }
fn compute_accuracy_value(&self) -> f64 { fn compute_accuracy_value(&self) -> f64 {