예제 #1
0
        public void ProcessResponse_Should_ResetIntervalForBadAnswer(ResponseQuality qual)
        {
            var interval = RepetitionInterval.FromValues(4, 2.5f);

            interval.ProcessResponse(qual);
            interval.Interval.Should().Be(1);
        }
예제 #2
0
        private float CalculateUpdatedEasinessFactor(ResponseQuality responseQuality)
        {
            int   q       = (int)responseQuality;
            float updated = EasinessFactor - 0.8f + 0.28f * q - 0.02f * q * q;

            if (updated < 1.3f)
            {
                updated = 1.3f;
            }
            return(updated);
        }
예제 #3
0
        public void ProcessResponse_ShouldNot_UpdateStartBadAnswer(ResponseQuality badQuality)
        {
            var interval = RepetitionInterval.NewDefault();

            interval.ProcessResponse(badQuality);
            interval.ProcessResponse(badQuality);
            interval.ProcessResponse(badQuality);
            interval.Interval.Should().Be(0);

            interval.ProcessResponse(ResponseQuality.CorrectPerfect);
            interval.ProcessResponse(ResponseQuality.CorrectPerfect);
            interval.Interval.Should().Be(0);
        }
예제 #4
0
        private void TryIncrementInterval(ResponseQuality responseQuality)
        {
            if (responseQuality < ResponseQuality.CorrectDifficult)
            {
                if (_interval < 0)
                {
                    return;
                }

                _interval = 1;
            }
            else
            {
                _interval++;
            }
        }
예제 #5
0
 public void ProcessResponse(ResponseQuality responseQuality)
 {
     TryIncrementInterval(responseQuality);
     EasinessFactor = CalculateUpdatedEasinessFactor(responseQuality);
 }