Connor Dunnigan 6 vuotta sitten
vanhempi
commit
cc5bae1b34

+ 9
- 9
src/main/java/io/zipcoder/casino/dicegames/Craps.java Näytä tiedosto

@@ -50,10 +50,9 @@ public class Craps extends DiceGame implements Gamble {
50 50
 
51 51
     public void play(CrapsPlayer currentPlayer) {
52 52
         placeBet(currentPlayer);
53
-        int sum = rollDie(2);
54
-
53
+        int sum;
55 54
         promptEnterKey("roll dice");
56
-        printRollSum(sum);
55
+        printRollSum(sum = rollDie(2));
57 56
 
58 57
         simulateCraps(currentPlayer, sum);
59 58
     }
@@ -77,12 +76,6 @@ public class Craps extends DiceGame implements Gamble {
77 76
         } while (sum != point && sum != 7);
78 77
     }
79 78
 
80
-    public void print(){
81
-        for(int i = 0; i < crapsPlayers.size(); i++){
82
-            System.out.println(crapsPlayers.get(i).getP().getChipBalance());
83
-        }
84
-    }
85
-
86 79
     public void printRollAgain(int point){
87 80
         console.println("\n=====================" +
88 81
                 "\nPoint to roll for: " + point + "\n=====================");
@@ -107,6 +100,7 @@ public class Craps extends DiceGame implements Gamble {
107 100
         console.println("\n*********\nYOU LOSE!\n*********\n");
108 101
         evaluateBet(player, -bet);
109 102
     }
103
+
110 104
     public void evalWin(Player player){
111 105
         console.println("\n*******************************\n" +
112 106
                 "WINNER WINNER CHICKEN DINNER!\n" +
@@ -120,8 +114,14 @@ public class Craps extends DiceGame implements Gamble {
120 114
 
121 115
     public void promptEnterKey(String str){
122 116
         String input = console.getStringInput("\n>> " +
117
+
123 118
                 "Press \"ENTER\" to " + str);
124 119
     }
120
+    public void print(){
121
+        for(int i = 0; i < crapsPlayers.size(); i++){
122
+            System.out.println(crapsPlayers.get(i).getP().getChipBalance());
123
+        }
124
+    }
125 125
 
126 126
     @Override
127 127
     public void promptContinue(){}

+ 3
- 2
src/main/java/io/zipcoder/casino/utilities/Dice.java Näytä tiedosto

@@ -7,6 +7,7 @@ package io.zipcoder.casino.utilities;
7 7
     public class Dice {
8 8
         public int dieCount;
9 9
         private ArrayList<Integer> lastRoll = new ArrayList<Integer>();
10
+        Console console = new Console();
10 11
 
11 12
         private HashMap<Integer, Character> diceGraphics = new HashMap<Integer, Character>() {{
12 13
             put(1,'⚀');
@@ -21,12 +22,12 @@ package io.zipcoder.casino.utilities;
21 22
             return diceGraphics.get(roll);
22 23
         }
23 24
 
24
-        public String getLastRollGraphic() {
25
+        public void getLastRollGraphic() {
25 26
             String lastRollGraphic = "";
26 27
             for (Integer roll : lastRoll) {
27 28
                 lastRollGraphic += getDieGraphic(roll) + " ";
28 29
             }
29
-            return lastRollGraphic;
30
+            console.println("------------------------\nRoll: " + lastRollGraphic);
30 31
         }
31 32
 
32 33
         public Dice(int dieCount) {

+ 1
- 0
src/main/java/io/zipcoder/casino/utilities/abstracts/DiceGame.java Näytä tiedosto

@@ -9,6 +9,7 @@ public abstract class DiceGame extends Game {
9 9
     public int rollDie(int num) {
10 10
         Dice dice = new Dice(num);
11 11
         int sum = dice.tossAndSum();
12
+        dice.getLastRollGraphic();
12 13
         return sum;
13 14
     }
14 15