public static double GetDrawMarginFromDrawProbability(double drawProbability, double beta) { return(GaussianDistribution.InverseCumulativeTo(0.5 * (drawProbability + 1), 0, 1) * Sqrt2 * beta); }
/// <summary> /// Get the player win probability based on the player's ratings. /// </summary> /// <param name="gameInfo">The game info we are calculating for.</param> /// <param name="playerRating">This player's rating.</param> /// <param name="opponentRating">The opponent's rating.</param> /// <returns>The chance that this player wins the match.</returns> protected override double GetPlayerWinProbability(GameInfo gameInfo, double playerRating, double opponentRating) { double ratingDifference = playerRating - opponentRating; return(GaussianDistribution.CumulativeTo(ratingDifference / (Sqrt2 * gameInfo.Beta))); }
/// <summary> /// Get the absolute difference between two distributions. /// </summary> /// <param name="left">The left operand.</param> /// <param name="right">The right operand.</param> /// <returns></returns> public static double AbsoluteDifference(GaussianDistribution left, GaussianDistribution right) { return(Math.Max(Math.Abs(left.PrecisionMean - right.PrecisionMean), Math.Sqrt(Math.Abs(left.Precision - right.Precision)))); }