mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-13 15:36:42 +08:00
Create function to calculate acc with grace
This commit is contained in:
parent
b57cbcc359
commit
56e8d3a065
1 changed files with 6 additions and 0 deletions
|
@ -167,6 +167,12 @@ export function setLastSecondNotRound() {
|
|||
export function calculateAccuracy() {
|
||||
return (accuracy.correct / (accuracy.correct + accuracy.incorrect)) * 100;
|
||||
}
|
||||
export function calculateAccuracyWithGrace() {
|
||||
const period = Math.min(accuracy.correct + accuracy.incorrect, 15) / 15;
|
||||
const grace = Math.pow(period, 2.5);
|
||||
const incorrect = accuracy.incorrect * grace;
|
||||
return (accuracy.correct / (accuracy.correct + incorrect)) * 100;
|
||||
}
|
||||
|
||||
export function incrementAccuracy(correctincorrect) {
|
||||
if (correctincorrect) {
|
||||
|
|
Loading…
Reference in a new issue