using System.Collections.Generic; using Moserware.Skills.TrueSkill; namespace Moserware.Skills { /// /// Calculates a TrueSkill rating using . /// public static class TrueSkillCalculator { // Keep a singleton around private static readonly SkillCalculator _Calculator = new FactorGraphTrueSkillCalculator(); /// /// Calculates new ratings based on the prior ratings and team ranks. /// /// Parameters for the game. /// A mapping of team players and their ratings. /// The ranks of the teams where 1 is first place. For a tie, repeat the number (e.g. 1, 2, 2) /// All the players and their new ratings. public static IDictionary CalculateNewRatings(GameInfo gameInfo, IEnumerable > teams, params int[] teamRanks) { // Just punt the work to the full implementation return _Calculator.CalculateNewRatings(gameInfo, teams, teamRanks); } /// /// Calculates the match quality as the likelihood of all teams drawing. /// /// The underlying type of the player. /// Parameters for the game. /// A mapping of team players and their ratings. /// The match quality as a percentage (between 0.0 and 1.0). public static double CalculateMatchQuality(GameInfo gameInfo, IEnumerable> teams) { // Just punt the work to the full implementation return _Calculator.CalculateMatchQuality(gameInfo, teams); } } }