public SkillGaussian(SkillGaussian gaussian) { ID = gaussian.ID; IsJammer = gaussian.IsJammer; Precision = gaussian.Precision; Pam = gaussian.Pam; LastUpdated = gaussian.LastUpdated; }
// at some point, we'll need to take the current sigma of the player and increase it, probably based on time since last data private double CalculateTimeEffect(SkillGaussian player, DateTime newTime) { // how much do we want to scale the player's std dev? // it probably ought to be flat, not proportional // one way to think of it: how long would a well-understood player have to disappear to be treated as new again? // let's say two years-ish, and see what happens TimeSpan timeSpan = newTime - player.LastUpdated; if(timeSpan > _baseTimeSpan) { timeSpan = _baseTimeSpan; } double ratio = ((double)timeSpan.Ticks) / _baseTimeSpan.Ticks; double range = _baseSigma - player.Sigma; return range * ratio; }
private SkillGaussian CreatePlayerSkill(int playerID, bool isJammer, DateTime dateOfGame) { // variances, not std dev, are sum-able // a^2 + b^2 != (a+b)^2 var dictionary = isJammer ? _jammerSkillDictionary : _blockerSkillDictionary; if(!dictionary.ContainsKey(playerID)) { SkillGaussian newPlayer = new SkillGaussian(playerID, 500, _baseVariance, isJammer, dateOfGame); dictionary[playerID] = newPlayer; return newPlayer; } var startingPlayer = dictionary[playerID]; double tau = CalculateTimeEffect(startingPlayer, dateOfGame); startingPlayer.AddVariance(Math.Pow(tau, 2)); startingPlayer.LastUpdated = dateOfGame; return startingPlayer; }
private void CalculateNewPlayerRating(double c, double team1Multiplier, double v, double w, SkillGaussian player) { double meanMultiplier = player.Variance / c; double stdDevMultiplier = meanMultiplier / c; double playerMeanDelta = (team1Multiplier * meanMultiplier * v); double newMean = player.Mean + playerMeanDelta; double newVariance = player.Variance * (1 - (w * stdDevMultiplier)); SkillGaussian newValues = new SkillGaussian(player.ID, newMean, newVariance, player.IsJammer, player.LastUpdated); if(player.IsJammer) { _jammerSkillDictionary[player.ID] = newValues; } else { _blockerSkillDictionary[player.ID] = newValues; } }