private static ExpectedValues Operate(ExpectedValues values1, ExpectedValues values2, Func <double, double, double> operation) { return(new ExpectedValues { Frags = operation(values1.Frags, values2.Frags), Damage = operation(values1.Damage, values2.Damage), Spots = operation(values1.Spots, values2.Spots), Defense = operation(values1.Defense, values2.Defense), Winrate = operation(values1.Winrate, values2.Winrate), }); }
private static ExpectedValues Operate(ExpectedValues values, double d, Func <double, double, double> operation) { return(new ExpectedValues { Frags = operation(values.Frags, d), Damage = operation(values.Damage, d), Spots = operation(values.Spots, d), Defense = operation(values.Defense, d), Winrate = operation(values.Winrate, d), }); }
public static double EstimatedAccountWN8(IExpectedValueList expectedValueList, string version, WinrateRecord[] winrateRecords, Statistics cumulatedStats) { Dictionary <int, ExpectedValues> expectedValues = expectedValueList[version]; ExpectedValues cumulatedExpected = new ExpectedValues(); foreach (var winrateRecord in winrateRecords) { if (expectedValues.TryGetValue(winrateRecord.TankID, out ExpectedValues values)) { cumulatedExpected += values * winrateRecord.Battles; } } cumulatedExpected /= cumulatedStats.Battles; return(Calculate(cumulatedStats, cumulatedExpected)); }
public static double AccountWN8(Dictionary <int, ExpectedValues> expectedValues, Dictionary <int, Statistics> tankStats, out Statistics cumulatedStats) { cumulatedStats = new Statistics(); ExpectedValues cumulatedExpected = new ExpectedValues(); foreach (var pair in tankStats) { if (expectedValues.TryGetValue(pair.Key, out ExpectedValues values)) { cumulatedExpected += values * pair.Value.Battles; cumulatedStats += pair.Value; } } cumulatedExpected /= cumulatedStats.Battles; return(Calculate(cumulatedStats, cumulatedExpected)); }
public static double Calculate(Statistics statistics, ExpectedValues expectedValues) { if (statistics.Battles == 0) { return(0); } double battles = statistics.Battles; return(Calculate( statistics.Damage / battles, statistics.Spotted / battles, statistics.Frags / battles, statistics.Decap / battles, statistics.Victories / battles, expectedValues)); }
public static double Calculate(double damage, double spotted, double frags, double decap, double winrate, ExpectedValues expectedValues) { double rDamage = damage / expectedValues.Damage; double rSpot = spotted / expectedValues.Spots; double rFrag = frags / expectedValues.Frags; double rDef = decap / expectedValues.Defense; double rWin = winrate * 100 / expectedValues.Winrate; Func <double, double, double> normalize = (r, d) => (r - d) / (1 - d); double rWinC = Math.Max(0, normalize(rWin, 0.71)); double rDamageC = Math.Max(0, normalize(rDamage, 0.22)); double rFragC = Math.Max(0, Math.Min(rDamageC + 0.2, normalize(rFrag, 0.12))); double rSpotC = Math.Max(0, Math.Min(rDamageC + 0.1, normalize(rSpot, 0.38))); double rDefC = Math.Max(0, Math.Min(rDamageC + 0.1, normalize(rDef, 0.1))); return(980 * rDamageC + 210 * rDamageC * rFragC + 155 * rFragC * rSpotC + 75 * rDefC * rFragC + 145 * Math.Min(1.8, rWinC)); }
public double CalculateWN8(ExpectedValues expectedValues) { return(WN8.Calculate(AvgDamage, AvgSpotted, AvgFrags, AvgDecap, Winrate, expectedValues)); }