public PlayerMetrics() { /*EncouteredErrorsList = new Dictionary<string, ErrorMetrics>(); * givenHintsList = new Dictionary<string, HintMetrics>();*/ gameActivitiesList = new Dictionary <string, ActivityMetrics>(); timeMetricsObject = new TimeMetrics(); activityMetricsObject = new ActivityMetrics(); //rulesObject = new DiagnosticRules(); game_score = 0; game_score_previous_state = 0; max_game_score = 0; min_game_score = 0; game_score_triggers = new List <int>(); game_score_default_triggers = new List <int>(); game_score_thresholds_compared = new List <bool>(); game_score_default_triggers.Add(3); game_score_default_triggers.Add(23); }
public string TrackAndStoreErrorForThisActivity(string current_activity_ID, string error_ID) { ActivityMetrics current_activity = null; ErrorMetrics temp_error_for_first = null; string would_be_hint = ""; gameActivitiesList.TryGetValue(current_activity_ID, out current_activity); current_activity.EncouteredErrorsList .TryGetValue(error_ID, out temp_error_for_first); temp_error_for_first.ErrorMade(current_activity.time_on_activity.Elapsed); string errorInfo = error_ID + " timestamps: " + temp_error_for_first.error_time_stamps.Count + "# "; for (int i = 0; i < temp_error_for_first.error_time_stamps.Count; i++) { errorInfo += temp_error_for_first.error_time_stamps[i] + " "; } //rulesObject.CheckRulesForErrors(ref current_activity, ref would_be_hint); return("Hint: " + would_be_hint + " info for errors " + errorInfo); }
public void CheckRulesForErrors(/*ref ActivityMetrics*/ string activity_ID, ref string would_be_hint) { ActivityMetrics activity_container = null; playerMetricsObject.gameActivitiesList.TryGetValue(activity_ID, out activity_container); //check the rules for the errors and their limits foreach (var error in activity_container.EncouteredErrorsList) { int i = 0; foreach (var error_limit in error.Value.error_number_thresholds) { if (error_limit == error.Value.GetNumberOfErrors()) { //if(!error.Value.GetError_limit_compared(i)) if (!error.Value.error_thresholds_compared[i]) { error.Value.error_thresholds_compared[i] = true; //error.Value.SetError_limit_compared(i,true); //CheckRulesForHintMetrics(error.Key, ref would_be_hint); would_be_hint = "Error: " + error.Key.ToString() + ", limit: " + error_limit + ", number: " + error.Value.GetNumberOfErrors(); //send the indicator (per error type) indicatorsObject.StoreMainIndicator(error.Key.ToString() + "Threshold"); //and check if an auxiliary indicator should be activated CheckThresholdsForMainIndicators(); } } i++; } } //check the rules for the timestamps of the errors from previously //and the average time in the game (measeured from previous playthroughs //split the average time into 3 periods (early, middle, late) /*int hours = .Hours; * int mins = playerMetricsObject.timeMetricsObject.average_time_since_beginning_of_game.Minutes; * int secs = playerMetricsObject.timeMetricsObject.average_time_since_beginning_of_game.Seconds;*/ //int average_time=(int) playerMetricsObject.timeMetricsObject.average_time_since_beginning_of_game.TotalSeconds; /*if(secs!=0) * { * average_time = secs; * } * if(mins!=0) * { * average_time += (mins*60); * } * if(hours!=0) * { * average_time += (hours*3600) * }*/ /*MIGHT NOT BE NEEDED * int early_period_end = average_time/3; * int middle_period_end = early_period_end*2; * int late_period_end = average_time; * * foreach(var error_from_the_past in playerMetricsObject.activityMetricsObject.EncouteredErrorsList) * { * foreach(var error_timestamps_from_the_past in * error_from_the_past.Value.error_time_stamps_from_previously) * { * if(error_timestamps_from_the_past.TotalSeconds<=early_period_end) * { * * } * else if(early_period_end<error_timestamps_from_the_past.TotalSeconds && * error_timestamps_from_the_past.TotalSeconds<=middle_period_end) * { * * } * else if(middle_period_end<error_timestamps_from_the_past.TotalSeconds && * error_timestamps_from_the_past.TotalSeconds<=late_period_end) * { * * } * } * }*/ /*for(int i=0;i<playerMetricsObject.EncouteredErrorsList.Count;i++) * { * for(int j=0;j<playerMetricsObject.EncouteredErrorsList.ElementAt(i).Value.error_number_limits.Count;j++) * { * if(playerMetricsObject.EncouteredErrorsList.ElementAt(i).Value.error_number_limits.ElementAt(j) * == playerMetricsObject.EncouteredErrorsList.ElementAt(i).Value.GetNumberOfErrors()) * { * * would_be_hint ="Error: "+playerMetricsObject.EncouteredErrorsList.ElementAt(i).Value +" number:"+ playerMetricsObject.EncouteredErrorsList.ElementAt(i).Value.GetNumberOfErrors(); * * } * } * }*/ }
public void CheckRulesForActivityMetrics(ref ActivityMetrics temp_activity_container, ref string would_be_hint) { string time_on_activity_threshold_ID = "timeOnActivityThreshold"; //compare the time time-on-activity with the time thresholds if (temp_activity_container.current_task_time_limit_index + 1 <= temp_activity_container.time_on_activity_thresholds.Count) { //CompareCurrentTaskTimeWithTaskTimeLimit(); //----------------- if (temp_activity_container.time_on_activity.Elapsed > temp_activity_container.time_on_activity_thresholds.ElementAt (temp_activity_container.current_task_time_limit_index) && temp_activity_container.time_on_activity_threshold_compared [temp_activity_container.current_task_time_limit_index] != true) { temp_activity_container.time_on_activity_threshold_compared[ temp_activity_container.current_task_time_limit_index] = true; } //------------- } if (temp_activity_container.current_task_time_limit_index + 1 <= temp_activity_container.time_on_activity_thresholds.Count) { if (temp_activity_container.time_on_activity_threshold_compared [temp_activity_container.current_task_time_limit_index]) { would_be_hint = "Task Over, man! Task Over! " + (temp_activity_container.current_task_time_limit_index + 1) + " out of " + temp_activity_container.time_on_activity_thresholds.Count; //send the indicator and its index to be stored or have its occurence incremented (if it already exists) indicatorsObject.StoreMainIndicator(time_on_activity_threshold_ID); //and check if an auxiliary indicator should be activated CheckThresholdsForMainIndicators(); temp_activity_container.current_task_time_limit_index++; } } /*//compare number of attempts limit * * * int i = 0; * foreach (var number_of_attempts_limit in temp_activity_container.limits_to_number_of_tries_to_solve) * { * if (number_of_attempts_limit == temp_activity_container.number_of_tries_to_solve) * { * if (!temp_activity_container.compared_limits_to_number_of_tries_to_solve[i]) * { * temp_activity_container.compared_limits_to_number_of_tries_to_solve[i] = true; * * //CheckRulesForHintMetrics(error.Key, ref would_be_hint); * would_be_hint = "Task: " + ", number_of_attempts_limit: " + number_of_attempts_limit + ", number: " + temp_activity_container.number_of_tries_to_solve; + + } + } + i++; + }*/ }