Advertisement
Guest User

Event move searcher

a guest
Mar 16th, 2019
121
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //this thing searches Showdown!'s learnset data and finds all event moves, like wish Chansey
  2. package notDefault;
  3.  
  4. import java.io.*;
  5. import java.util.ArrayList;
  6. import java.util.Scanner;
  7.  
  8. public class Scratch {
  9.  
  10. public static void main(String[] args) throws IOException{
  11. // TODO Auto-generated method stub
  12. BufferedReader input = new BufferedReader(new FileReader("learnsets.txt"));
  13. PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter("middle.txt")));
  14. String line = input.readLine();
  15. String maybePrint = "";
  16.  
  17. while(line != null) {
  18. if(line.contains("\"")) {
  19. ArrayList<String> list = toList(line);
  20. boolean print = true;
  21.  
  22. for(int i = 0; i < list.size(); i ++) {
  23. list.set(i, list.get(i).replace("0", ""));
  24. list.set(i, list.get(i).replace("1", ""));
  25. list.set(i, list.get(i).replace("2", ""));
  26. list.set(i, list.get(i).replace("3", ""));
  27. list.set(i, list.get(i).replace("4", ""));
  28. list.set(i, list.get(i).replace("5", ""));
  29. list.set(i, list.get(i).replace("6", ""));
  30. list.set(i, list.get(i).replace("7", ""));
  31. list.set(i, list.get(i).replace("8", ""));
  32. list.set(i, list.get(i).replace("9", ""));
  33.  
  34. if("L".equalsIgnoreCase(list.get(i))) {
  35. print = false;
  36. break;
  37. }
  38.  
  39. if("M".equalsIgnoreCase(list.get(i))) {
  40. print = false;
  41. break;
  42. }
  43.  
  44. if("E".equalsIgnoreCase(list.get(i))) {
  45. print = false;
  46. break;
  47. }
  48.  
  49. if("C".equalsIgnoreCase(list.get(i))) {
  50. print = false;
  51. break;
  52. }
  53.  
  54. if("T".equalsIgnoreCase(list.get(i))) {
  55. print = false;
  56. break;
  57. }
  58.  
  59. if("D".equalsIgnoreCase(list.get(i))) {
  60. print = false;
  61. break;
  62. }
  63.  
  64. if("V".equalsIgnoreCase(list.get(i))) {
  65. print = false;
  66. break;
  67. }
  68.  
  69. //print = true;
  70. }
  71.  
  72. if(print) {
  73. output.println(maybePrint + line);
  74. maybePrint = "";
  75. }
  76. }else {
  77. if(maybePrint.contains("}},") && "}},".equals(line.trim())){
  78. maybePrint = "";
  79. }
  80.  
  81. maybePrint = maybePrint + line + '\n';
  82. }
  83.  
  84. line = input.readLine();
  85. }
  86.  
  87. input.close();
  88. output.close();
  89. input = new BufferedReader(new FileReader("middle.txt"));
  90. output = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
  91. line = input.readLine();
  92.  
  93. while(line != null) {
  94. line = line.trim();
  95.  
  96. if(line.contains("[") && line.contains("]")) {
  97. output.print(line.substring(0, line.indexOf(':')) + ", ");
  98. }else {
  99. output.print("\n" + line.substring(0, line.indexOf(':') + 1) + ' ');
  100. }
  101.  
  102. line = input.readLine();
  103. }
  104.  
  105. input.close();
  106. output.close();
  107. }
  108.  
  109. public static ArrayList<String> toList(String line){
  110. ArrayList<String> list = new ArrayList<String>();
  111.  
  112. while(line.contains("\"")) {
  113. line = line.substring(line.indexOf("\"") + 1);
  114. //System.out.println(line);
  115. list.add(line.substring(0, line.indexOf("\"")));
  116. line = line.substring(line.indexOf("\"") + 1);
  117. }
  118.  
  119. return(list);
  120. }
  121. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement