|
@@ -15,6 +15,53 @@ public class HigherDice extends DiceGame implements Gambling {
|
15
|
15
|
Die aDie = new Die();
|
16
|
16
|
boolean playAgain = true;
|
17
|
17
|
|
|
18
|
+ public Console getaConsole() {
|
|
19
|
+ return aConsole;
|
|
20
|
+ }
|
|
21
|
+
|
|
22
|
+ public void setaConsole(Console aConsole) {
|
|
23
|
+ this.aConsole = aConsole;
|
|
24
|
+ }
|
|
25
|
+
|
|
26
|
+ public DrawSingleDie getDraw() {
|
|
27
|
+ return draw;
|
|
28
|
+ }
|
|
29
|
+
|
|
30
|
+ public void setDraw(DrawSingleDie draw) {
|
|
31
|
+ this.draw = draw;
|
|
32
|
+ }
|
|
33
|
+
|
|
34
|
+ public int getBet() {
|
|
35
|
+ return bet;
|
|
36
|
+ }
|
|
37
|
+
|
|
38
|
+ public void setBet(int bet) {
|
|
39
|
+ this.bet = bet;
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+ public Player getaPlayer() {
|
|
43
|
+ return aPlayer;
|
|
44
|
+ }
|
|
45
|
+
|
|
46
|
+ public void setaPlayer(Player aPlayer) {
|
|
47
|
+ this.aPlayer = aPlayer;
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+ public Die getaDie() {
|
|
51
|
+ return aDie;
|
|
52
|
+ }
|
|
53
|
+
|
|
54
|
+ public void setaDie(Die aDie) {
|
|
55
|
+ this.aDie = aDie;
|
|
56
|
+ }
|
|
57
|
+
|
|
58
|
+ public boolean isPlayAgain() {
|
|
59
|
+ return playAgain;
|
|
60
|
+ }
|
|
61
|
+
|
|
62
|
+ public void setPlayAgain(boolean playAgain) {
|
|
63
|
+ this.playAgain = playAgain;
|
|
64
|
+ }
|
18
|
65
|
|
19
|
66
|
public HigherDice(Player aPlayer) {
|
20
|
67
|
this.aPlayer = aPlayer;
|
|
@@ -27,9 +74,7 @@ public class HigherDice extends DiceGame implements Gambling {
|
27
|
74
|
while (playAgain == true) {
|
28
|
75
|
|
29
|
76
|
bet = wageMoney();
|
30
|
|
- aConsole.getStringInput("Please roll your die");
|
31
|
|
- aDie.rollADice();
|
32
|
|
- int player = aDie.getValue();
|
|
77
|
+ int player = playerPhase();
|
33
|
78
|
aConsole.println("Your Roll:\n" + draw.drawSingleDie(player).toString());
|
34
|
79
|
aDie.rollADice();
|
35
|
80
|
int croupier = aDie.getValue();
|
|
@@ -71,8 +116,17 @@ public class HigherDice extends DiceGame implements Gambling {
|
71
|
116
|
do {
|
72
|
117
|
bet = aConsole.getIntInput("How much would you like to bet? You can only bet what you currently have.\n" +
|
73
|
118
|
"Current chips= " + aPlayer.getTotalChips() + "\n");
|
74
|
|
- } while (bet > aPlayer.getTotalChips() && bet < 0);
|
75
|
|
-
|
|
119
|
+ } while (badBet() == true);
|
76
|
120
|
return bet;
|
77
|
121
|
}
|
|
122
|
+
|
|
123
|
+ public boolean badBet(){
|
|
124
|
+ return (bet > aPlayer.getTotalChips() || bet < 0);
|
|
125
|
+ }
|
|
126
|
+
|
|
127
|
+ public int playerPhase(){
|
|
128
|
+ aConsole.getStringInput("Please roll your die");
|
|
129
|
+ aDie.rollADice();
|
|
130
|
+ return aDie.getValue();
|
|
131
|
+ }
|
78
|
132
|
}
|