Advertisement
Guest User

Untitled

a guest
Jan 7th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.45 KB | None | 0 0
  1. Archana's AoA Point Decay Calculator
  2.  
  3. How To Use:
  4. Get a program that can run a java file, and copy and paste the following text into that program.
  5. Next, go to http://my.age-of-aincrad.com/function/full_leaderboard.php, and copy the data there, starting with the 1 at the very beginning (Don't include the text at the top, that's important. Example first line: 1 Konata 101222471 29920) and going to the very last person. Create a text file in the same folder as the program, titled leaderboard.txt (no caps, else there'll be an error) and paste all the info into it.
  6. Lastly, run the program. It will tell you how fast your multiplier will decrease.
  7.  
  8.  
  9. import java.util.Scanner;
  10. import java.util.ArrayList;
  11. import java.io.File;
  12. import java.io.IOException;
  13. public class Leaderboard
  14. {
  15. public static void main(String[] args) throws IOException{
  16. int[] placement = new int[999];
  17. String[] name = new String[999];
  18. int[] points = new int[999];
  19. int[] multiplier = new int[999];
  20. File filename = new File("leaderboard.txt");
  21. Scanner inFile = new Scanner(filename);
  22. String line = "";
  23. String parse = "";
  24. int index = 0;
  25. ArrayList<Integer> length = new ArrayList<Integer>();
  26. boolean test = false;
  27. while (inFile.hasNextLine()){
  28. line = inFile.nextLine();
  29. parse = (line.substring(0,line.indexOf(" ")));
  30. placement[index] = Integer.parseInt(parse);
  31. line = line.substring(line.indexOf(" ") + 1);
  32. name[index] = line.substring(0, line.indexOf(" "));
  33. line = line.substring(line.indexOf(" ")+1);
  34. parse = (line.substring(0, line.indexOf(" ")));
  35. points[index] = Integer.parseInt(parse);
  36. line = line.substring(line.indexOf(" ")+1);
  37. multiplier[index] = Integer.parseInt(line);
  38. index++;
  39. length.add(points[index]);
  40. }
  41. double total = 0;
  42. for (int index2 = 0; index2 < length.size(); index2++){
  43. total +=points[index2];
  44. }
  45. double average = total/length.size();
  46.  
  47.  
  48. Scanner in = new Scanner(System.in);
  49. int index3 = 0;
  50. int choice = 0;
  51. int importantPosition =0;
  52. String importantName = "";
  53. while (true){
  54. System.out.println("Would you like to know about a name or a position?");
  55. System.out.println("(1) Name");
  56. System.out.println("(2) Position");
  57. choice = in.nextInt();
  58. if (choice == 1 || choice == 2){
  59. break;
  60. } else {
  61. System.out.println("This was an invalid choice. Please try again.");
  62. }
  63. }
  64.  
  65. if (choice == 1){
  66. System.out.println("Enter a name you'd like to know about. Partial names work.");
  67. importantName = in.next();
  68.  
  69. while( index3 < length.size()){
  70. if (name[index3].contains(importantName)){
  71. importantName = name[index3];
  72. break;
  73. }
  74. index3++;
  75. }
  76. } else if (choice == 2) {
  77. System.out.println("Enter the position you'd like to know about.");
  78. while(true){
  79. if (in.hasNextInt()){
  80. importantPosition = in.nextInt();
  81. break;
  82. } else {
  83. System.out.println("This is not a valid choice. Try again.");
  84. }
  85. }
  86. index3 = importantPosition - 1;
  87. importantName = name[index3];
  88. }
  89. if (index3 >= length.size()){
  90. System.out.println("This person could not be found.");
  91. } else {
  92. System.out.println("This person's full name is: " + importantName);
  93. System.out.println("This person's position is: " + (index3+1));
  94. System.out.println("This person has " + points[index3] + " points");
  95. System.out.println("This person has a " + multiplier[index3] + " multiplier");
  96. System.out.printf("This person is subjected to multiplier decay %.2f times faster than the average person. %n", points[index3]/average);
  97. System.out.printf("This means that this person will begin to lose multiplier after %.2f minutes of inactivity,", 360/(points[index3]/average));
  98. System.out.printf("%nat a rate of 1 every 30 seconds. The rate of decay will increase by 1 every %.2f minutes.", 360/(points[index3]/average));
  99. }
  100.  
  101.  
  102. }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement