Created
February 15, 2018 00:42
-
-
Save Vazkii/65e68fa93f82a6437443320d15ae9085 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RankCalc { | |
static final int LP_PER = 25; | |
static final int XP_PER = 830; | |
static int rank, lp, xp, plays, xpEarned; | |
public static void main(String[] args) { | |
rank = 2; | |
xp = plays = xpEarned = 0; | |
lp = getMaxLP(rank); | |
while(lp >= LP_PER) | |
play(); | |
System.out.println("Final Rank is " + rank); | |
System.out.println("Played " + plays + " songs, and earned a total of " + xpEarned + " XP"); | |
System.out.printf("Assuming 1:40 per song, this would take you %.2f hours.%n", plays * 100.0 / 3600.0); | |
System.out.printf("Or %.2f hours, if you use 4X.%n", plays * 25.0 / 3600.0); | |
} | |
static void play() { | |
xp += XP_PER; | |
xpEarned += XP_PER; | |
lp -= LP_PER; | |
plays++; | |
while(xp > getXPReq(rank)) | |
rankUp(); | |
} | |
static void rankUp() { | |
xp -= getXPReq(rank); | |
rank++; | |
lp += getMaxLP(rank); | |
} | |
static int getXPReq(int rank) { | |
return (int) (Math.round(34.45 * rank - 551) * (rank < 100 ? 0.5 : 1)); | |
} | |
static int getMaxLP(int rank) { | |
return 25 + (int) Math.floor(Math.min(rank, 300) / 2) + (int) Math.floor(Math.max(rank - 300, 0) / 3); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment