Beispiel #1
0
 public static Memorization Update(Memorization knowledgeLicense, KnowledgeQualities knowledgeQuality, double complexity)
 {
     if (IsOkButBeforeTime(knowledgeLicense, knowledgeQuality))
     {
         knowledgeQuality = KnowledgeQualities.StillRemember;
     }
     return(KnowledgeLicenseProviders[knowledgeQuality].Grant(knowledgeLicense, complexity));
 }
Beispiel #2
0
        /// <summary>
        /// </summary>
        /// <param name="currentMemorization">Complexity of the game from 0 to 1]</param>
        /// <param name="complexity"></param>
        /// <returns></returns>
        public virtual Memorization Grant(Memorization currentMemorization, double complexity)
        {
            if (complexity > 1.0 || complexity < 0.0)
            {
                throw new ArgumentOutOfRangeException(nameof(complexity));
            }

            int days = Ebbinghaus(currentMemorization.Period, complexity);

            currentMemorization.RepeatTime = DateTime.UtcNow.AddDays(days);
            return(currentMemorization);
        }
Beispiel #3
0
 private static bool IsBefore(Memorization knowledgeLicense)
 {
     return(knowledgeLicense.RepeatTime > DateTime.UtcNow.AddDays(DAYS_GRANTING_TIMESPAN));
 }
Beispiel #4
0
 private static bool IsOkButBeforeTime(Memorization knowledgeLicense, KnowledgeQualities knowledgeQuality)
 {
     return(knowledgeQuality.Equals(KnowledgeQualities.EasyToRemember) && IsBefore(knowledgeLicense));
 }