SHARE
TWEET

ClashRoyaleDeckCounter.java

a guest May 12th, 2016 266 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.*;
  2. import javax.swing.JOptionPane;
  3. import java.util.*;
  4. class ClashRoyaleDeckCounter {
  5.  
  6.     public static void main(String[] args) throws IOException {
  7.  
  8. ArrayList<String> list = new ArrayList<String>();
  9. ArrayList<String> dlist = new ArrayList<String>();
  10. ArrayList<Integer> total = new ArrayList<Integer>();
  11. int i = 1;
  12. String[] possibleValues = {"Archers","Baby Dragon","Barbarians","Bomber","Balloon","Dark Prince","Fire Spirits","Giant","Giant Skeletons","Goblins","Golem","Guards","Hog Rider","Ice Wizard","Knight","Lava Hound","Miner","Mini P.E.K.K.A","Minions","Minion Horde","Musketeer","P.E.K.K.A","Prince","Princess","Royal Giant","Skeleton Army","Skeleton","Sparky","Spear Goblin","Three Musketeers","Valkyrie","Witch","Wizard","Arrows","Freeze","Fireball","Goblin Barrel","Lightning","Mirror","Poison","Rage","Rocket","Zap","Barbarian Hut","Bomber Tower","Cannon","Elixir Collector","Furnace","Goblin Hut","Inferno Tower","Mortar","Tombstone","Tesla","Zrt"};
  13. Arrays.sort(possibleValues);
  14. possibleValues[53] = "Done";
  15. for (int x = 0; x<8; x++)
  16.   {
  17.     Object n = JOptionPane.showInputDialog(null,"Choose One", "Deck#" + i,JOptionPane.INFORMATION_MESSAGE, null,possibleValues, possibleValues[0]);
  18.     list.add((String)n);
  19. }
  20. while(!(list.get(0).equals("Done")))
  21. {
  22.   String h = "";
  23.   Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
  24.   for (int c = 0; c<8; c++)
  25.   {
  26.     h += list.get(c) + " ";
  27.   }
  28.   int p = 0;
  29.   int g = 0;
  30.   for (String item : dlist) {
  31.     if (h.equals(item))
  32.     {
  33.       total.set(p, total.get(p)+1);
  34.     g++;
  35.   }
  36.     p++;
  37.   }
  38. if (g==0)
  39. {
  40.   dlist.add(h);
  41.   total.add(1);
  42. }
  43.   list.clear();
  44.  i++;
  45.  
  46. for (int x = 0; x<8; x++)
  47.   {
  48.    Object n = JOptionPane.showInputDialog(null,"Choose One", "Deck#" + i,JOptionPane.INFORMATION_MESSAGE, null,possibleValues, possibleValues[0]);
  49.     list.add((String)n);
  50. }
  51. }
  52. for (int o = 0; o<total.size(); o++)
  53. {
  54.   System.out.println(dlist.get(o) + " : " + total.get(o));
  55. }
  56.       }}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top