-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculations.java
More file actions
33 lines (29 loc) · 1 KB
/
Copy pathCalculations.java
File metadata and controls
33 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.ArrayList;
/**
* The class which runs the calculation I came up with (See README for details)
* Takes in lists of history objects for a particular character with each of their allies
* and enemies as well as the overall regional winrate
* Returns a double which represents the score (similar to a winrate) for the average player
*/
public class Calculations {
public static double calculateWinMultiplier(ArrayList<History> allyHists, ArrayList<History> enemyHists, double globalWin) {
double differentialSum = 0;
double xpos = inv(globalWin);
for (History aH : allyHists) {
double perc = aH.getPerc();
differentialSum += (inv(perc) - xpos);
}
for (History eH : enemyHists) {
double perc = eH.getPerc();
differentialSum += (inv(perc) - xpos);
}
return sig(xpos + differentialSum);
}
public static double sig(double x) {
return 1/(1 + Math.pow(Math.E, -x));
}
public static double inv(double perc) {
perc = perc/100;
return Math.log(perc/(((double) 1)-perc));
}
}