impl sm2next

master
Bel LaPointe 2023-04-07 10:06:21 -06:00
parent 8dbe8e852f
commit 439039010a
1 changed files with 30 additions and 0 deletions

30
sm2.go Normal file
View File

@ -0,0 +1,30 @@
package main
func SM2Next(thisGrade int, consecutivePassesBeforeThis int, ef float64, lastInterval int) (int, float64, int) {
q := thisGrade
n := consecutivePassesBeforeThis
ef = ef
i := lastInterval
if q >= 3 {
switch n {
case 0:
i = 1
case 1:
i = 6
default:
i = int(float64(i) * ef)
}
n += 1
} else {
n = 0
i = 1
}
ef = ef + (.1 - (5.0-float64(q))*(.08+(5.0-float64(q))*.02))
if ef < 1.3 {
ef = 1.3
}
return n, ef, i
}