mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-20 20:16:16 -04:00
Extracted pure functions to make tests happy
This commit is contained in:
parent
8d7d97608d
commit
a4e24fd397
5 changed files with 199 additions and 193 deletions
7
src/pure_functions.ts
Normal file
7
src/pure_functions.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
export function clamp(value: number, min: number, max: number) {
|
||||
return Math.max(min, Math.min(value, max));
|
||||
}
|
||||
|
||||
export function comboKeepingRate(level: number) {
|
||||
return clamp(1 - 1 / (1 + level) * 1.5, 0, 1)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue