/// <summary> /// Updates the motivation state of a player with an motivation evidence. /// </summary> /// /// <param name="me"> Motivation evidence for the update. </param> internal void updateMotivationState(MotivationEvidence me) { loggingMAs("Start updating motivation state."); MotivationState currentMs = getMotivationState(); MotivationState newMs = currentMs.getCopy(); MotivationAssessmentAssetSettings maas = (MotivationAssessmentAssetSettings)getMAsA().Settings; if (me.EvidenceType == EvidenceType.LevelReached) { updatePrimaryMotivationAspect(newMs, "satisfaction", true); lastTimeUpdated = DateTime.Now; } else if (me.EvidenceType == EvidenceType.ProblemSolved) { if (me.FirstTryDuration < maas.FirstTryMinDuration) { updatePrimaryMotivationAspect(newMs, "attention", false); } else { if (me.SolvingDuration > maas.SolutionMaxDuration) { updatePrimaryMotivationAspect(newMs, "attention", false); } else { updatePrimaryMotivationAspect(newMs, "attention", true); } if (me.NoOfErrors > maas.MaxNoErrors || me.NoOfHelpRequests > maas.MaxNoHelpRequests) { updatePrimaryMotivationAspect(newMs, "confidence", false); } else { updatePrimaryMotivationAspect(newMs, "confidence", true); } } } else { loggingMAs("Warning: Evidence Type unknown!", Severity.Warning); } //downgrade satisfaction, if too much time passed by checkSatisfactionDowngrade(newMs); //Method for storing changes storeNewMotivationState(newMs); }
/// <summary> /// Methode generating a motivation evidence out of a motivation hint series and processing this evidence further. /// </summary> /// /// <param name="mhs"> List of Motivation hints forming a series. </param> internal void evaluateHintSeries(List <MotivationHint> mhs) { loggingMAs("Hint series complete - start evaluating series."); MotivationEvidence me = new MotivationEvidence(); if (mhs[mhs.Count - 1].HintId == "new level") { me.EvidenceType = EvidenceType.LevelReached; if (mhs.Count != 1) { loggingMAs("Hint series corrupted! - no evaluation done."); return; } } else if (mhs[mhs.Count - 1].HintId == "success") { if (mhs[0].HintId != "new problem") { loggingMAs("Hint series corrupted! - no evaluation done."); return; } me.EvidenceType = EvidenceType.ProblemSolved; TimeSpan ts = mhs[mhs.Count - 1].OccurTime - mhs[0].OccurTime; me.SolvingDuration = ts.TotalSeconds; ts = mhs[1].OccurTime - mhs[0].OccurTime; me.FirstTryDuration = ts.TotalSeconds; me.NoOfErrors = 0; me.NoOfHelpRequests = 0; foreach (MotivationHint mh in mhs) { if (mh.HintId.Equals("fail")) { me.NoOfErrors++; } else if (mh.HintId.Equals("help")) { me.NoOfHelpRequests++; } } } updateMotivationState(me); }