Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. package luke8;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.File;
  5. import java.io.FileNotFoundException;
  6. import java.io.FileReader;
  7. import java.io.FileWriter;
  8. import java.io.IOException;
  9. import java.lang.reflect.Array;
  10. import java.util.ArrayList;
  11. import java.util.Arrays;
  12. import java.util.Collections;
  13. import java.util.HashMap;
  14. import java.util.Hashtable;
  15. import java.util.Map.Entry;
  16.  
  17. public class Luke8 {
  18.  
  19. public static void main(String[] args) throws IOException {
  20. // FileWriter fw = new FileWriter("o.txt");
  21. FileReader fr = new FileReader(new File("d.txt"));
  22. BufferedReader br = new BufferedReader(fr);
  23.  
  24. HashMap<String, Integer> ps = new HashMap<String, Integer>();
  25.  
  26. String line = null;
  27.  
  28. int ladderCount = 0;
  29. int pC = 0;
  30. while ((line = br.readLine()) != null) {
  31. int dice = Integer.parseInt(line);
  32.  
  33. pC++;
  34. if (pC > 1337) {
  35. pC = 1;
  36. }
  37.  
  38. String pl = pC + " Player " + pC;
  39.  
  40. if (!ps.containsKey(pl)) {
  41. ps.put(pl, dice+1);
  42.  
  43. } else {
  44.  
  45. ps.put(pl, ps.get(pl) + dice);
  46.  
  47. }
  48.  
  49. int prev = ps.get(pl) - dice;
  50.  
  51. if (ps.get(pl) == 90) {
  52. System.out.println("P: " + pC + " Dice: " + dice + " Val: "
  53. + ps.get(pC) + " " + ladderCount + " " + prev);
  54. // System.out.println(ladderCount);
  55. }
  56.  
  57. switch (ps.get(pl)) {
  58. case 3:
  59. prev = ps.get(pl);
  60. ps.put(pl, 17);
  61. ladderCount++;
  62. break;
  63. case 8:
  64. prev = ps.get(pl);
  65. ps.put(pl, 10);
  66. ladderCount++;
  67. break;
  68. case 15:
  69. prev = ps.get(pl);
  70. ps.put(pl, 44);
  71. ladderCount++;
  72. break;
  73. case 22:
  74. prev = ps.get(pl);
  75. ps.put(pl, 5);
  76. ladderCount++;
  77. break;
  78. case 39:
  79. prev = ps.get(pl);
  80. ps.put(pl, 56);
  81. ladderCount++;
  82. break;
  83. case 49:
  84. prev = ps.get(pl);
  85. ps.put(pl, 75);
  86. ladderCount++;
  87. break;
  88. case 62:
  89. prev = ps.get(pl);
  90. ps.put(pl, 45);
  91. ladderCount++;
  92. break;
  93. case 64:
  94. prev = ps.get(pl);
  95. ps.put(pl, 19);
  96. ladderCount++;
  97. break;
  98. case 65:
  99. prev = ps.get(pl);
  100. ps.put(pl, 73);
  101. ladderCount++;
  102. break;
  103. case 80:
  104. prev = ps.get(pl);
  105. ps.put(pl, 12);
  106. ladderCount++;
  107. break;
  108. case 87:
  109. prev = ps.get(pl);
  110. ps.put(pl, 79);
  111. ladderCount++;
  112. break;
  113. default:
  114.  
  115. break;
  116. }
  117.  
  118. if (ps.get(pl) > 90) {
  119. ps.put(pl, ps.get(pl) + prev);
  120. }
  121. }
  122. br.close();
  123. // fw.close();
  124.  
  125. }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement