Chad 6 лет назад
Родитель
Сommit
cc29fa0b52
1 измененных файлов: 11 добавлений и 12 удалений
  1. 11
    12
      src/main/java/io/zipcoder/casino/Leviathan/Games/HigherDice.java

+ 11
- 12
src/main/java/io/zipcoder/casino/Leviathan/Games/HigherDice.java Просмотреть файл

@@ -8,12 +8,12 @@ import io.zipcoder.casino.Leviathan.Player;
8 8
 
9 9
 
10 10
 public class HigherDice extends DiceGame implements Gambling {
11
-    Console aConsole = new Console();
12
-    DrawSingleDie draw = new DrawSingleDie();
13
-    int bet;
14
-    Player aPlayer;
15
-    Die aDie = new Die();
16
-    boolean playAgain = true;
11
+    private Console aConsole = new Console();
12
+    private DrawSingleDie draw = new DrawSingleDie();
13
+    private int bet;
14
+    private Player aPlayer;
15
+    private Die aDie = new Die();
16
+    private boolean playAgain = true;
17 17
 
18 18
     public HigherDice(Player aPlayer) {
19 19
         this.aPlayer = aPlayer;
@@ -69,7 +69,7 @@ public class HigherDice extends DiceGame implements Gambling {
69 69
 
70 70
     public void playGame() {
71 71
         aConsole.print("Welcome to HigherDice!\nWe will both roll a die, and the higher number wins the wager.\nThe House wins on ties\n");
72
-        while (playAgain == true) {
72
+        while (playAgain) {
73 73
             findWinner(wageMoney(), playerPhase(), housePhase());
74 74
             repeat();
75 75
         }
@@ -84,7 +84,7 @@ public class HigherDice extends DiceGame implements Gambling {
84 84
         }
85 85
     }
86 86
 
87
-    public void findWinner(int wageAmount,int player, int croupier) {
87
+    public void findWinner(int wageAmount, int player, int croupier) {
88 88
 
89 89
         if (player > croupier) {
90 90
             aPlayer.setTotalChips(aPlayer.getTotalChips() + wageAmount);
@@ -101,11 +101,10 @@ public class HigherDice extends DiceGame implements Gambling {
101 101
     }
102 102
 
103 103
     public int wageMoney() {
104
-
105 104
         do {
106 105
             bet = aConsole.getIntInput("How much would you like to bet? You can only bet what you currently have.\n" +
107 106
                     "Current chips= " + aPlayer.getTotalChips() + "\n");
108
-        } while (badBet() == true);
107
+        } while (badBet());
109 108
         return bet;
110 109
     }
111 110
 
@@ -113,14 +112,14 @@ public class HigherDice extends DiceGame implements Gambling {
113 112
         return (bet > aPlayer.getTotalChips() || bet < 0);
114 113
     }
115 114
 
116
-    public int playerPhase() {
115
+    private int playerPhase() {
117 116
         aConsole.getStringInput("Please roll your die");
118 117
         aDie.rollADice();
119 118
         aConsole.println("Your Roll:\n" + draw.drawSingleDie(aDie.getValue()).toString());
120 119
         return aDie.getValue();
121 120
     }
122 121
 
123
-    public int housePhase() {
122
+    private int housePhase() {
124 123
         aDie.rollADice();
125 124
         aConsole.println("House Roll:\n" + draw.drawSingleDie(aDie.getValue()).toString());
126 125
         return aDie.getValue();