Skip to content

Instantly share code, notes, and snippets.

@Notoh
Last active June 19, 2018 18:30
Show Gist options
  • Save Notoh/9cd9926d3c6605024c38ce0a5e4a198a to your computer and use it in GitHub Desktop.
Save Notoh/9cd9926d3c6605024c38ce0a5e4a198a to your computer and use it in GitHub Desktop.
UPDATED NEW ALGORITHM
public class RankedCvCCalc {
public static void main(String[] args) {
double teamOne = Double.parseDouble(args[0]);
double teamTwo = Double.parseDouble(args[1]);
//Now we have the ELOs, find the round diff and calculate based on elo difference.
int rdiff = Integer.parseInt(args[2]);
int rApplyDiff = 0;
switch((int) Math.abs(rdiff)) {
case 1:
rApplyDiff = 8;
break;
case 2:
rApplyDiff = 14;
break;
case 3:
rApplyDiff = 16;
case 4:
rApplyDiff = 18;
break;
case 5:
rApplyDiff = 21;
break;
case 6:
rApplyDiff = 24;
break;
case 7:
rApplyDiff = 26;
break;
case 8:
rApplyDiff = 28;
break;
case 9:
rApplyDiff = 30;
break;
default:
System.err.println("WHAT THE FUCK");
}
double teamOneChange = 0;
double teamTwoChange = 0;
double multi = findMulti(teamOne, teamTwo);
teamOneChange = rApplyDiff > 0 ? rApplyDiff*multi : -rApplyDiff*multi;
teamTwoChange = rApplyDiff > 0 ? -rApplyDiff*multi : rApplyDiff*multi;
System.out.printf("%f %f", teamOneChange, teamTwoChange);
}
private static double findMulti(double elo, double elo2) {
if(elo - elo2 < -300)
return 3;
else if(elo - elo2 < -200)
return 2;
else if(elo - elo2 < -150)
return 1.66;
else if(elo - elo2 < -100)
return 1.4;
else if(elo - elo2 < -50)
return 1.2;
else if(elo - elo2 < -25)
return 1.1;
else if(elo - elo2 < 25)
return 1;
else if(elo - elo2 < 50)
return 0.91;
else if(elo - elo2 < 100)
return 0.83;
else if(elo - elo2 < 150)
return 0.71;
else if(elo - elo2 < 200)
return 0.6;
else if(elo - elo2 < 300)
return 0.5;
else
return 0.33;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment