Skill tree progression system & whitespace support
This commit is contained in:
@@ -7,8 +7,8 @@ pub fn compute_score(result: &DrillResult, complexity: f64) -> f64 {
|
||||
(speed * complexity) / (errors + 1.0) * (length / 50.0)
|
||||
}
|
||||
|
||||
pub fn compute_complexity(unlocked_count: usize) -> f64 {
|
||||
(unlocked_count as f64 / 26.0).max(0.1)
|
||||
pub fn compute_complexity(unlocked_count: usize, total_keys: usize) -> f64 {
|
||||
(unlocked_count as f64 / total_keys as f64).max(0.1)
|
||||
}
|
||||
|
||||
pub fn level_from_score(total_score: f64) -> u32 {
|
||||
@@ -38,8 +38,8 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_complexity_scales_with_letters() {
|
||||
assert!(compute_complexity(26) > compute_complexity(6));
|
||||
assert!((compute_complexity(26) - 1.0).abs() < 0.001);
|
||||
fn test_complexity_scales_with_keys() {
|
||||
assert!(compute_complexity(96, 96) > compute_complexity(6, 96));
|
||||
assert!((compute_complexity(96, 96) - 1.0).abs() < 0.001);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user