private bool StudyFlashcard(StudentMemory mem, double t) { double r = calcR(mem, t); if (rand.NextDouble() < r) { //win int interval = 0; if (mem.lossCount == 0) { mem.strength = calc.CalcWinStr(mem.strength); interval = calc.CalcWinInterval(mem.strength, mem.lastInterval, mem.intervalCount++); } else { mem.strength = calc.CalcLossStr(mem.strength, mem.lossCount); interval = calc.CalcLostInterval(mem.strength, mem.lastInterval, mem.intervalCount++); } mem.tNextReview = t + interval; mem.tStart = t; mem.lastInterval = interval; mem.lossCount = 1; mem.algoStrength++; return(true); } else { mem.tStart = t; mem.lossCount++; return(false); } }
private static double calcR(StudentMemory mem, double t) { double deltaT = t - mem.tStart; double r = NewMethod(mem, deltaT); return(r); }
private static double NewMethod(StudentMemory mem, double deltaT) { return(Math.Exp(-deltaT / (mem.algoStrength * 10))); }