Browse Source

Merge branch 'master' of https://git.zipcode.rocks/JenniferChao4/Casino

Demetrius Murray 6 years ago
parent
commit
de95b3f1c6

+ 229
- 32
src/main/java/io/zipcoder/casino/CardGame/BlackJack/BlackJack.java View File

@@ -4,6 +4,7 @@ import io.zipcoder.casino.CardGame.Card;
4 4
 import io.zipcoder.casino.CardGame.CardGame;
5 5
 import io.zipcoder.casino.CardGame.Deck;
6 6
 import io.zipcoder.casino.CardGame.Face;
7
+import io.zipcoder.casino.Casino_test;
7 8
 import io.zipcoder.casino.Interfaces.Gamble;
8 9
 import io.zipcoder.casino.Player;
9 10
 
@@ -19,35 +20,33 @@ public class BlackJack extends CardGame implements Gamble {
19 20
     private boolean justDealt = false;
20 21
     private int numOfTurns = 0;
21 22
     private BlackJackPlayer dealer = new BlackJackPlayer(new Dealer());
23
+    int stands = 0;
22 24
 
23 25
 
24 26
     public BlackJack(Player player) {
25 27
         BlackJackPlayer blackJackPlayer = new BlackJackPlayer(player);
26 28
         blackJackPlayers.add(dealer);
27 29
         this.blackJackPlayers.add(blackJackPlayer);
30
+        deck.shuffle();
28 31
     }
29 32
 
30 33
     public void hit(BlackJackPlayer player) {
31 34
         setJustDealt(false);
32 35
         Card card = deck.draw();
33 36
         player.addToHand(card);
37
+        countPlayerHand(player);
34 38
 
35
-        if (countPlayerHand(player).get(0) > 21 || (countPlayerHand(player).size() == 2 && countPlayerHand(player).get(1) > 21)) {
36
-            System.out.println("Your Current Hand: \n" + formatHand(player.getPlayerHand()) + "\nHand Value: " + formatHandValue(countPlayerHand(player)) + "\nToo high, you lose!");
37
-        } else {
38
-            System.out.println("Your Current Hand: \n" + formatHand(player.getPlayerHand()) + "\nHand Value: " + formatHandValue(countPlayerHand(player)));
39
+
40
+        if (player == blackJackPlayers.get(1)) {
41
+            System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYou Hit: " + card.toString());
42
+        } else if (player == this.dealer) {
43
+            System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer Hit: " + card.toString());
39 44
         }
40
-    }
41 45
 
42
-//    public void flip() {
43
-//        // shoulder technically be card.setCovered(false); or something like that
44
-//        boolean covered = false;
45
-//    }
46
+    }
46 47
 
47 48
     public void split(BlackJackPlayer player) {
48 49
 
49
-        System.out.println(player.getPlayerHand() + "\n");
50
-
51 50
         Card movingCard = player.getPlayerHand().get(1);
52 51
 
53 52
         if (justDealt && player.getPlayerHand().get(0).getFace() == player.getPlayerHand().get(1).getFace()) {
@@ -56,14 +55,11 @@ public class BlackJack extends CardGame implements Gamble {
56 55
             player.getPlayerHand().remove(movingCard);
57 56
         }
58 57
 
59
-        System.out.println(player.getPlayerHand() + " " + player.getSecondHand());
60 58
         setJustDealt(false);
61
-
62
-        // must be the same card value
63 59
     }
64 60
 
65 61
     public void doubleDown(BlackJackPlayer blackJackPlayer) {
66
-        if (getJustDealt() == true) {
62
+        if (getJustDealt()) {
67 63
             blackJackPlayer.addToBetPot(blackJackPlayer.getInitialBet());
68 64
         }
69 65
 
@@ -72,8 +68,8 @@ public class BlackJack extends CardGame implements Gamble {
72 68
     }
73 69
 
74 70
     public void stand() {
75
-        endTurn();
76
-        // (end turn?) what does "take a turn" actually initiate
71
+        setJustDealt(false);
72
+        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nStanding still!");
77 73
     }
78 74
 
79 75
     public int calculate_AceIsOne(BlackJackPlayer player) {
@@ -132,18 +128,15 @@ public class BlackJack extends CardGame implements Gamble {
132 128
     }
133 129
 
134 130
     public void deal() {
135
-        deck.shuffle();
136 131
 
137 132
         for (int i = 0; i < 2; i++) {
138 133
             for (BlackJackPlayer player : this.blackJackPlayers) {
139 134
                 Card card = deck.draw();
140 135
                 player.addToHand(card);
136
+                countPlayerHand(player);
141 137
             }
142 138
         }
143 139
 
144
-        System.out.println("Your Current Hand: \n" + formatHand(this.blackJackPlayers.get(1).getPlayerHand()) + "\nHand Value: " + formatHandValue(countPlayerHand(this.blackJackPlayers.get(1))) + "\n");
145
-        System.out.println("Dealer's Current Hand: \nMYSTERY-CARD || " + formatHand(dealer.getDealerHand()) + "\nHand Value: ??" + "\n");
146
-
147 140
         setJustDealt(true);
148 141
     }
149 142
 
@@ -152,25 +145,211 @@ public class BlackJack extends CardGame implements Gamble {
152 145
     }
153 146
 
154 147
     public BlackJackPlayer getDealer() {
155
-        return dealer;
148
+        return this.dealer;
156 149
     }
157 150
 
158 151
     public void start() {
159
-        Scanner reader = new Scanner(System.in);
160
-        System.out.println("Enter an initial bet: ");
161
-        int initialBet = reader.nextInt();
162
-
152
+        Scanner scanner = new Scanner(System.in);
153
+        Casino_test instance = Casino_test.getInstance();
154
+        // System.out.println("\nWould you like the hear the rules of the game?\n<< Yes - No - Quit >>");
155
+        // String userInput = scanner.nextLine();
156
+        int initialBet;
157
+        // String input = userInput.toUpperCase();
158
+
159
+        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nHow much would you like to bet?");
160
+        initialBet = scanner.nextInt();
163 161
         start(initialBet);
162
+
163
+//        switch (input) {
164
+//            case "YES":
165
+//                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nGoogle. Okay, let's begin!\n\nHow much would you like to bet?");
166
+//                initialBet = scanner.nextInt();
167
+//                start(initialBet);
168
+//                break;
169
+//            case "NO":
170
+//                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nOkay, let's begin!\n\nHow much would you like to bet?");
171
+//                initialBet = scanner.nextInt();
172
+//                start(initialBet);
173
+//                break;
174
+//            case "QUIT":
175
+//                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nk bye felicia");
176
+//                // go back to casino??
177
+//                break;
178
+//            default:
179
+//                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nPlease try again.");
180
+//                start();
181
+//                break;
182
+//        }
164 183
     }
165 184
 
166 185
     public void start(int initialBet) {
167
-        // upon starting a new game, every player places a bet? make a loop???
168
-        BlackJackPlayer blackJackPlayer = blackJackPlayers.get(0);
186
+        Casino_test instance = Casino_test.getInstance();
187
+        BlackJackPlayer blackJackPlayer = blackJackPlayers.get(1);
188
+
169 189
         if (initialBet < minBet) {
170
-            System.out.println("TOo low");
190
+            System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nThe minimum bet is $50. Please try again.");
191
+            start();
171 192
         } else {
172
-            blackJackPlayer.setInitialBet(betAmount(initialBet, blackJackPlayers.get(0)));
193
+            blackJackPlayer.setInitialBet(betAmount(initialBet, blackJackPlayers.get(1)));
194
+        }
195
+
196
+        // Player player = new Player("Theta Thunder the III");
197
+        Scanner scanner = new Scanner(System.in);
198
+
199
+        // BlackJack blackJack = new BlackJack(player);
200
+
201
+        // BlackJackPlayer blackJackPlayer = blackJack.getPlayer(1);
202
+        // BlackJackPlayer dealer = blackJack.getDealer();
203
+
204
+        BlackJackPlayer activePlayer;
205
+//
206
+//        System.out.println("\nWelcome to BlackJack!\n\nThe minimum bet is $50.");
207
+//        blackJack.start();
208
+
209
+        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nGAME START - DEALING CARDS   test player name" + blackJackPlayer.getPlayer().getName());
210
+        deal();
211
+
212
+        int turnNumber = getNumOfTurns();
213
+        int stands = getStands();
214
+
215
+        boolean flag = true;
216
+
217
+        while (flag) {
218
+            if (turnNumber % 2 == 1) {
219
+                activePlayer = this.dealer;
220
+            } else {
221
+                activePlayer = blackJackPlayer;
222
+            }
223
+
224
+            ArrayList<Integer> handValue = countPlayerHand(activePlayer);
225
+
226
+            if (turnNumber == 0 && this.dealer.getHandValue() == 21) {
227
+                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\n" + formatHand(this.dealer.getPlayerHand()) + "\n\nDealer's Hand Value: " + this.dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nBlackjack! Dealer wins!");
228
+                blackJackPlayer.getPlayer().setWallet(blackJackPlayer.getPlayer().getWallet() - (blackJackPlayer.getBetPot() * 2));
229
+                System.out.println("\nYou Lost $" + blackJackPlayer.getBetPot() * 2 + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
230
+                flag = false;
231
+            } else if (turnNumber == 0 && blackJackPlayer.getHandValue() == 21) {
232
+                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Hand: \n\n" + formatHand(blackJackPlayer.getPlayerHand()) + "\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nBlackjack! Player wins!");
233
+                blackJackPlayer.getPlayer().setWallet(blackJackPlayer.getPlayer().getWallet() + (blackJackPlayer.getBetPot() * 2));
234
+                System.out.println("\nYou Won: $" + blackJackPlayer.getBetPot() * 2 + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
235
+                flag = false;
236
+            } else if (activePlayer == blackJackPlayer && stands < 2) {
237
+
238
+                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\nMYSTERY-CARD || " + formatHand(this.dealer.getDealerHand()) + "\n\nDealer's Hand Value: ??" +
239
+                        "\n\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Hand: \n\n" + formatHand(blackJackPlayer.getPlayerHand()) + "\n\nYour Hand Value: " + formatHandValue(handValue) +
240
+                        "\n\n~~~~~~~~~~~~~~~~~~~\n\nYOUR TURN" + "\n\n~~~~~~~~~~~~~~~~~~~\n\nWhat do you want to do?\n<< Hit - Stand - Double Down - Split - Quit >>");
241
+                String inputResponse = scanner.nextLine();
242
+                String response = inputResponse.toUpperCase();
243
+
244
+                switch (response) {
245
+                    case "HIT":
246
+                        hit(blackJackPlayer);
247
+
248
+                        if (blackJackPlayer.getHandValue() > 21) {
249
+                            System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Hand: \n\n" + formatHand(blackJackPlayer.getPlayerHand()) + "\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nToo high, you lose!");
250
+                            blackJackPlayer.getPlayer().setWallet(blackJackPlayer.getPlayer().getWallet() - blackJackPlayer.getBetPot());
251
+                            System.out.println("\nYou Lost $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
252
+                            flag = false;
253
+                        } else if (blackJackPlayer.getHandValue() == 21) {
254
+                            System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Hand: \n\n" + formatHand(blackJackPlayer.getPlayerHand()) + "\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nYou win!!! YAYAYAYAYAYAYYAYAYAYAYAYYY");
255
+                            blackJackPlayer.getPlayer().setWallet(blackJackPlayer.getPlayer().getWallet() + blackJackPlayer.getBetPot());
256
+                            System.out.println("\nYou Won: $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
257
+                            flag = false;
258
+                        }
259
+                        break;
260
+                    case "STAND":
261
+                        setNumOfTurns(turnNumber++);
262
+                        stand();
263
+                        stands++;
264
+                        break;
265
+                    case "DOUBLE DOWN":
266
+                        if (getJustDealt()) {
267
+                            doubleDown(activePlayer);
268
+                            System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Bet: " + blackJackPlayer.getBetPot());
269
+                        } else {
270
+                            System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYou can only double down right after the deal. Please choose another option.");
271
+                        }
272
+                        break;
273
+                    case "SPLIT":
274
+                        split(activePlayer);
275
+                        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nok so the code itself works but idk how to actually implement it into the game without going crazy so plz choose something else");
276
+                        break;
277
+                    case "QUIT":
278
+                        instance.chooseGame();
279
+                        break;
280
+                    default:
281
+                        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nInput unknown, please try again");
282
+                        break;
283
+                }
284
+            } else if (activePlayer == this.dealer && stands < 2) {
285
+
286
+                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDEALER'S TURN");
287
+
288
+                if (this.dealer.getHandValue() > 15 && this.dealer.getHandValue() < 21) {
289
+                    setNumOfTurns(turnNumber++);
290
+                    stand();
291
+                } else {
292
+                    hit(this.dealer);
293
+
294
+                    if (this.dealer.getHandValue() > 21) {
295
+                        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\n" + formatHand(this.dealer.getPlayerHand()) + "\n\nDealer's Hand Value: " + this.dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nDealer bust, you win!");
296
+                        blackJackPlayer.getPlayer().setWallet(blackJackPlayer.getPlayer().getWallet() + blackJackPlayer.getBetPot());
297
+                        System.out.println("\nYou Won: $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
298
+                        flag = false;
299
+                    } else if (this.dealer.getHandValue() == 21) {
300
+                        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\n" + formatHand(this.dealer.getPlayerHand()) + "\n\nDealer's Hand Value: " + this.dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nBlackjack! Dealer wins!");
301
+                        blackJackPlayer.getPlayer().setWallet(blackJackPlayer.getPlayer().getWallet() - blackJackPlayer.getBetPot());
302
+                        System.out.println("\nYou Lost $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
303
+                        flag = false;
304
+                    } else if (handValue.get(0) < 21 || (handValue.size() > 2 && handValue.get(1) < 21)) {
305
+                        setNumOfTurns(turnNumber++);
306
+                        stand();
307
+                    }
308
+                }
309
+                stands++;
310
+
311
+            } else if (stands == 2) {
312
+                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDETERMINING WINNER...");
313
+
314
+                if (blackJackPlayer.getHandValue() > this.dealer.getHandValue()) {
315
+                    System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\nDealer's Hand Value: " + this.dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nYou win!");
316
+                    blackJackPlayer.getPlayer().setWallet(blackJackPlayer.getPlayer().getWallet() + blackJackPlayer.getBetPot());
317
+                    System.out.println("\nYou Won: $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
318
+                } else if (blackJackPlayer.getHandValue() < this.dealer.getHandValue()) {
319
+                    System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\nDealer's Hand Value: " + this.dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nDealer wins! You lose!");
320
+                    blackJackPlayer.getPlayer().setWallet(blackJackPlayer.getPlayer().getWallet() - blackJackPlayer.getBetPot());
321
+                    System.out.println("\nYou Lost $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
322
+                } else if (blackJackPlayer.getHandValue() == this.dealer.getHandValue()) {
323
+                    System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\nDealer's Hand Value: " + this.dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nTie, no one wins");
324
+                    System.out.println("\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
325
+                }
326
+                flag = false;
327
+            }
328
+        }
329
+
330
+        this.dealer.resetHand();
331
+        blackJackPlayer.resetHand();
332
+        setNumOfTurns(0);
333
+        setStands(0);
334
+        blackJackPlayer.setInitialBet(0);
335
+        blackJackPlayer.setBetPot(0);
336
+
337
+        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nWould you like to play again?\n\n<< Yes - No >>");
338
+        String userInput = scanner.nextLine();
339
+        String input = userInput.toUpperCase();
340
+
341
+        switch (input) {
342
+            case "YES":
343
+                start();
344
+                break;
345
+            case "NO":
346
+                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nReturning to the Casino!");
347
+                // go back to casino
348
+                instance.chooseGame();
349
+                break;
173 350
         }
351
+
352
+
174 353
     }
175 354
 
176 355
     public void end() {
@@ -178,7 +357,6 @@ public class BlackJack extends CardGame implements Gamble {
178 357
     }
179 358
 
180 359
     public void takeATurn() {
181
-
182 360
     }
183 361
 
184 362
     // add to game interface?
@@ -199,6 +377,10 @@ public class BlackJack extends CardGame implements Gamble {
199 377
         }
200 378
     }
201 379
 
380
+    public ArrayList<BlackJackPlayer> getBlackJackPlayers() {
381
+        return blackJackPlayers;
382
+    }
383
+
202 384
     public int betAmount(int amount, BlackJackPlayer blackJackPlayer) {
203 385
         blackJackPlayer.addToBetPot(amount);
204 386
         return betAmount(amount, blackJackPlayer.getPlayer());
@@ -220,6 +402,22 @@ public class BlackJack extends CardGame implements Gamble {
220 402
         this.justDealt = justDealt;
221 403
     }
222 404
 
405
+    public int getStands() {
406
+        return stands;
407
+    }
408
+
409
+    public void setStands(int stands) {
410
+        this.stands = stands;
411
+    }
412
+
413
+    public int getNumOfTurns() {
414
+        return numOfTurns;
415
+    }
416
+
417
+    public void setNumOfTurns(int numOfTurns) {
418
+        this.numOfTurns = numOfTurns;
419
+    }
420
+
223 421
     public String formatHand(ArrayList<Card> array) {
224 422
         String stringHand = "";
225 423
 
@@ -232,7 +430,6 @@ public class BlackJack extends CardGame implements Gamble {
232 430
                 stringHand += " || ";
233 431
             }
234 432
         }
235
-
236 433
         return stringHand;
237 434
     }
238 435
 

+ 15
- 5
src/main/java/io/zipcoder/casino/CardGame/BlackJack/BlackJackPlayer.java View File

@@ -46,13 +46,21 @@ public class BlackJackPlayer {
46 46
     }
47 47
 
48 48
     public ArrayList<Card> getDealerHand() {
49
-        ArrayList<Card> dealerHandRemoveMystery = new ArrayList<>();
50
-
51
-        for (int i = 1; i < this.playerHand.size(); i++) {
52
-           dealerHandRemoveMystery.add(this.playerHand.get(i));
49
+        if (this.player.getName().equals("Dealer")) {
50
+            ArrayList<Card> dealerHandRemoveMystery = new ArrayList<>();
51
+
52
+            for (int i = 1; i < this.playerHand.size(); i++) {
53
+                dealerHandRemoveMystery.add(this.playerHand.get(i));
54
+            }
55
+            return dealerHandRemoveMystery;
56
+        } else {
57
+            throw new IllegalStateException("This player is not the dealer.");
53 58
         }
59
+    }
54 60
 
55
-        return dealerHandRemoveMystery;
61
+    public ArrayList<Card> resetHand(){
62
+        this.playerHand = new ArrayList<>();
63
+        return this.playerHand;
56 64
     }
57 65
 
58 66
     public Player getPlayer() {
@@ -71,6 +79,8 @@ public class BlackJackPlayer {
71 79
         return this.betPot;
72 80
     }
73 81
 
82
+    public void setBetPot(int value) {this.betPot = value; }
83
+
74 84
     public void setInitialBet(int amount){
75 85
         this.initialBet = amount;
76 86
     }

+ 9
- 1
src/main/java/io/zipcoder/casino/CardGame/BlackJack/Dealer.java View File

@@ -4,6 +4,14 @@ import io.zipcoder.casino.Player;
4 4
 
5 5
 public class Dealer extends Player {
6 6
 
7
-    public Dealer() { }
7
+    private final String name;
8
+
9
+    public Dealer() {
10
+        name = "Dealer";
11
+    }
12
+
13
+    public String getName() {
14
+        return name;
15
+    }
8 16
 
9 17
 }

+ 120
- 0
src/main/java/io/zipcoder/casino/Casino_test.java View File

@@ -0,0 +1,120 @@
1
+package io.zipcoder.casino;
2
+
3
+// BlackJack
4
+// Solitaire
5
+// Craps
6
+// Roulette?
7
+// Slot Machine?
8
+
9
+// Jackpot option? Low chance but player wins $1mil
10
+//
11
+
12
+import io.zipcoder.casino.CardGame.BlackJack.BlackJack;
13
+import io.zipcoder.casino.DiceGame.Craps.Craps;
14
+import io.zipcoder.casino.CardGame.Solitaire.Solitaire;
15
+import io.zipcoder.casino.Interfaces.Game;
16
+
17
+import java.util.Scanner;
18
+
19
+public final class Casino_test {
20
+
21
+    private final static Casino_test instance = new Casino_test();
22
+
23
+    private Player player;
24
+
25
+    private final String casinoName = "Thunder Theta";
26
+
27
+    private Casino_test() {
28
+    }
29
+
30
+    public void chooseGame() {
31
+        Scanner scanner = new Scanner(System.in);
32
+        System.out.println("\n\nWhat game would you like to play?\n<< BlackJack - Solitaire - Craps - Leave >>");
33
+        String userInput = scanner.nextLine();
34
+        String input = userInput.toUpperCase();
35
+
36
+        boolean flag = true;
37
+
38
+        while (flag) {
39
+            switch (input) {
40
+                case "SOLITAIRE":
41
+                    break;
42
+                case "BLACKJACK":
43
+                    BlackJack blackJack = new BlackJack(player);
44
+                    System.out.println("\nHi " + instance.getPlayer().getName() + "! Welcome to BlackJack!\n\nThe minimum bet is $50.\n");
45
+                    flag = false;
46
+                    blackJack.start();
47
+                    break;
48
+                case "CRAPS":
49
+                    Craps craps = new Craps(player);
50
+                    flag = false;
51
+                    craps.gamePlay();
52
+                    break;
53
+                case "LEAVE":
54
+                    System.out.println("Thanks for coming to Thunder Theta, good bye!");
55
+                    flag = false;
56
+                    break;
57
+                default:
58
+                    System.out.println("I don't know what that game is. Please try again.");
59
+                    break;
60
+            }
61
+        }
62
+    }
63
+
64
+    public void setPlayer(Player player) {
65
+        this.player = player;
66
+    }
67
+
68
+    public Player getPlayer() {
69
+        return this.player;
70
+    }
71
+
72
+    public static Casino_test getInstance() {
73
+        return instance;
74
+    }
75
+
76
+    public String getCasinoName() {
77
+        return this.casinoName;
78
+    }
79
+
80
+    public static void main(String[] args) {
81
+        Scanner scanner = new Scanner(System.in);
82
+        Casino_test instance = Casino_test.getInstance();
83
+        System.out.println("Welcome to " + instance.getCasinoName() + "! What is your name?");
84
+        String playerName = scanner.nextLine();
85
+        Player player = new Player(playerName);
86
+        instance.setPlayer(player);
87
+        instance.chooseGame();
88
+    }
89
+
90
+//    private int money;
91
+//    private String casinoName;
92
+//    private Game game;
93
+//    private Player player;
94
+//    private String currentGame;
95
+//
96
+//    public void selectGame(int gameNum) {
97
+//
98
+//        switch (gameNum) {
99
+//            case 1:
100
+//                Game blackJack = new BlackJack(player);
101
+//                break;
102
+//            case 2:
103
+//                Game solitaire = new Solitaire(player);
104
+//                break;
105
+//            case 3:
106
+//                Game craps = new Craps(player);
107
+//                break;
108
+//            case 4:
109
+//                leaveCasino();
110
+//                break;
111
+//            default:
112
+//                System.out.println("Input unknown, please pick again.");
113
+//                break;
114
+//        }
115
+//    }
116
+//
117
+//    public void leaveCasino() {
118
+//    }
119
+
120
+}

+ 46
- 24
src/main/java/io/zipcoder/casino/DiceGame/Craps/Craps.java View File

@@ -23,6 +23,8 @@ public class Craps extends DiceGame implements Gamble {
23 23
     private int pointer;
24 24
 
25 25
 
26
+
27
+
26 28
     public Craps(Player player) {
27 29
         CrapsPlayers crappyPlayer = new CrapsPlayers(player);
28 30
         this.crapsPlayer = new CrapsPlayers(player);
@@ -32,14 +34,21 @@ public class Craps extends DiceGame implements Gamble {
32 34
     }
33 35
 
34 36
     public void gamePlay(){
35
-        System.out.println("What would you like to bet? Min bet is: " + minBet);
37
+        System.out.println("What would you like to bet? Min bet is: $" + minBet);
36 38
         int amount = scanner.nextInt();
37
-        System.out.println("Are you ready to roll?");
39
+        //add a try catch
40
+        if (amount<minBet){
41
+            System.out.println("Sorry but the minimum bet is $"+minBet);
42
+            gamePlay();
43
+        }
44
+        crapsPlayer.setInitialBet(amount);
45
+        System.out.println("Are you ready to roll?  yes or no");
38 46
         String response = scanner.next();
39 47
         if(response.equalsIgnoreCase("yes")) {
40
-            rollDice();
41
-        } else {
42
-            System.out.println("ready yet?");
48
+        } else if(response.equalsIgnoreCase("no")) {
49
+            gamePlay();
50
+        } else{
51
+            System.out.println("no valid");
43 52
         }
44 53
         firstRoll();
45 54
         remainingRolls();
@@ -48,28 +57,44 @@ public class Craps extends DiceGame implements Gamble {
48 57
     public int rollDice() {
49 58
         int sum = rollDice(2);
50 59
         System.out.println("Total = " + sum);
60
+        System.out.println("______________");
51 61
         rollNumber++;
52 62
         return sum;
53 63
     }
54 64
 
55 65
     public void firstRoll() {
56
-        rollDice();
57
-        if (rollDice() == 7 || rollDice() == 11) {
66
+        int result = rollDice();
67
+        if (result == 7 || result == 11) {
58 68
             win(crapsPlayer);
59
-        } else if (rollDice() == 2 || rollDice() == 3 || rollDice() == 12) {
69
+        } else if (result == 2 || result == 3 || result == 12) {
60 70
             lose(crapsPlayer);
61 71
         } else {
62
-            pointer = rollDice();
72
+            pointer = result;
63 73
         }
64 74
     }
65 75
 
66 76
     public void remainingRolls() {
67
-        rollDice();
68
-        if (rollDice() == pointer) {
77
+        System.out.println("Are you ready to roll?  yes or no");
78
+        String response = scanner.next();
79
+        if(response.equalsIgnoreCase("yes")) {
80
+        } else if(response.equalsIgnoreCase("no")) {
81
+            System.out.println("would you like to exit?");
82
+            String response2 = scanner.next();
83
+            if(response2.equalsIgnoreCase("yes")){
84
+                exitTable(crapsPlayer);
85
+            } else if(response2.equalsIgnoreCase("no")){
86
+                gamePlay();
87
+            }
88
+        } else{
89
+            System.out.println("not valid");
90
+        }
91
+        int result = rollDice();
92
+        if (result == pointer) {
69 93
             win(crapsPlayer);
70
-        } else if (rollDice() == 7) {
94
+        } else if (result == 7) {
71 95
             lose(crapsPlayer);
72
-        }
96
+        } else
97
+            remainingRolls();
73 98
     }
74 99
 
75 100
     public int betAmount(int amount, Player player) {
@@ -82,21 +107,17 @@ public class Craps extends DiceGame implements Gamble {
82 107
     }
83 108
 
84 109
     public void win(CrapsPlayers crapsPlayers){
85
-        player.setWallet(player.getWallet() + crapsPlayers.getBetPot() * 2);
86
-        System.out.println("Congrats! You won: $" + crapsPlayers.getBetPot());
87
-        System.out.println("Would you like to play again?");
88
-        String response = scanner.next();
89
-        if(response.equalsIgnoreCase("yes")) {
90
-            start();
91
-        } else if(response.equalsIgnoreCase("no")) {
92
-            end();
93
-        } else {
94
-            System.out.println("Sorry I didn't quite get that, try again!");
95
-        }
110
+       crapsPlayers.setWallet(crapsPlayers.getWallet() + crapsPlayers.getInitialBet() * 2);
111
+        System.out.println("Congrats! You won: $" + crapsPlayers.getInitialBet());
112
+        playAgain();
96 113
     }
97 114
 
98 115
     public void lose(CrapsPlayers crapsPlayers) {
99 116
         System.out.println("I'm so sorry, you lose!");
117
+      playAgain();
118
+    }
119
+
120
+    public void playAgain(){
100 121
         System.out.println("Would you like to play again?");
101 122
         String response = scanner.next();
102 123
         if(response.equalsIgnoreCase("yes")) {
@@ -106,6 +127,7 @@ public class Craps extends DiceGame implements Gamble {
106 127
         } else {
107 128
             System.out.println("Sorry I didn't quite get that, try again!");
108 129
         }
130
+        end();
109 131
     }
110 132
 
111 133
     public void distributePot(int amount, Player player) {

+ 10
- 7
src/main/java/io/zipcoder/casino/DiceGame/Craps/CrapsPlayers.java View File

@@ -5,7 +5,7 @@ import io.zipcoder.casino.Player;
5 5
 public class CrapsPlayers {
6 6
 
7 7
         private Player player;
8
-
8
+        private int wallet;
9 9
         private int initialBet;
10 10
         private int rollValue;
11 11
         private int betPot;
@@ -21,21 +21,24 @@ public class CrapsPlayers {
21 21
             return player;
22 22
         }
23 23
 
24
-        public int getInitialBet() {
25
-            return initialBet;
26
-        }
27
-
28 24
         public void addToBetPot(int amount) {
29 25
             betPot += amount;
30 26
             this.player.setWallet(player.getWallet()- amount);
31 27
         }
32 28
 
33
-        public int getBetPot() {
34
-            return betPot;
29
+        public int getInitialBet() {
30
+            return initialBet;
35 31
         }
36 32
 
37 33
         public void setInitialBet(int amount){
38 34
             this.initialBet = amount;
39 35
         }
40 36
 
37
+    public void setWallet(int wallet) {
38
+            this.wallet = wallet;
39
+    }
40
+
41
+    public int getWallet() {
42
+            return wallet;
41 43
     }
44
+}

+ 26
- 3
src/main/java/io/zipcoder/casino/DiceGame/DiceGame.java View File

@@ -6,6 +6,16 @@ public abstract class DiceGame implements Game {
6 6
 
7 7
     private int numOfDice = 2;
8 8
     private int[] die = new int[numOfDice];
9
+    private char one = '⚀';
10
+    private char two = '⚁';
11
+    private char three = '⚂';
12
+    private char four = '⚃';
13
+    private char five = '⚄';
14
+    private char six = '⚅';
15
+
16
+    public void displayDice(){
17
+
18
+    }
9 19
 
10 20
     public int rollDice(int numOfDice) {
11 21
         int sum = 0;
@@ -13,9 +23,22 @@ public abstract class DiceGame implements Game {
13 23
         for (int i = 0; i < numOfDice; i++) {
14 24
             die[i] = (int) Math.floor((Math.random() * 6) + 1);
15 25
             sum += die[i];
16
-            System.out.println("Die #" + (i+1) + " = " + die[i]);
26
+            if (die[i] == 1) {
27
+                System.out.println(one);
28
+            } else if (die[i] == 2) {
29
+                System.out.println(two);
30
+            } else if (die[i] == 3) {
31
+                System.out.println(three);
32
+            } else if (die[i] == 4) {
33
+                System.out.println(four);
34
+            } else if (die[i] == 5) {
35
+                System.out.println(five);
36
+            } else if (die[i] == 6) {
37
+                System.out.println(six);
38
+            }
39
+
40
+
17 41
         }
18 42
         return sum;
19 43
     }
20
-
21
-}
44
+}

+ 2
- 4
src/main/java/io/zipcoder/casino/Player.java View File

@@ -23,14 +23,12 @@ public class Player {
23 23
         return name;
24 24
     }
25 25
 
26
-    public void setName(String name) {
27
-        this.name = name;
28
-    }
29 26
 
30 27
 
31 28
 
32 29
 
33
-    public Player() { }
30
+    public Player() {
31
+    }
34 32
 
35 33
 
36 34
 

+ 16
- 0
src/main/java/io/zipcoder/casino/Test.java View File

@@ -0,0 +1,16 @@
1
+package io.zipcoder.casino;
2
+
3
+import io.zipcoder.casino.DiceGame.Craps.Craps;
4
+import io.zipcoder.casino.DiceGame.Dice;
5
+import io.zipcoder.casino.DiceGame.DiceGame;
6
+
7
+public class Test {
8
+
9
+    public static void main(String[] args) {
10
+
11
+        Player Crappy = new Player("Crappy");
12
+        Craps game1 = new Craps(Crappy);
13
+
14
+        game1.gamePlay();
15
+    }
16
+}

+ 68
- 0
src/test/java/io/zipcoder/casino/CardGame/BlackJack/BlackJackPlayerTest.java View File

@@ -0,0 +1,68 @@
1
+package io.zipcoder.casino.CardGame.BlackJack;
2
+
3
+import io.zipcoder.casino.CardGame.Card;
4
+import io.zipcoder.casino.CardGame.Deck;
5
+import io.zipcoder.casino.CardGame.Face;
6
+import io.zipcoder.casino.CardGame.Suit;
7
+import io.zipcoder.casino.Player;
8
+import org.junit.Assert;
9
+import org.junit.Test;
10
+
11
+import java.util.ArrayList;
12
+
13
+public class BlackJackPlayerTest {
14
+
15
+    Deck deck = new Deck();
16
+    Player player = new Player("Jack Black");
17
+    BlackJack blackJack = new BlackJack(player);
18
+    BlackJackPlayer testPlayer = blackJack.getPlayer(1);
19
+    ArrayList<Card> testHand = testPlayer.getPlayerHand();
20
+
21
+    @Test
22
+    public void testPlayerHasAce_True() {
23
+        Card ace = new Card(Suit.HEARTS, Face.ACE);
24
+
25
+        testHand.add(ace);
26
+        testHand.add(deck.draw());
27
+        testHand.add(deck.draw());
28
+
29
+        boolean expected = true;
30
+        boolean actual = testPlayer.hasAce();
31
+
32
+        Assert.assertEquals(expected, actual);
33
+    }
34
+
35
+    @Test
36
+    public void testPlayerHasAce_False() {
37
+        testHand.add(deck.draw());
38
+        testHand.add(deck.draw());
39
+        testHand.add(deck.draw());
40
+
41
+        boolean expected = false;
42
+        boolean actual = testPlayer.hasAce();
43
+
44
+        Assert.assertEquals(expected, actual);
45
+    }
46
+
47
+    @Test
48
+    public void testGetDealerHand() {
49
+        ArrayList<Card> dealerHand = blackJack.getPlayer(0).getPlayerHand();
50
+        dealerHand.add(deck.draw());
51
+        dealerHand.add(deck.draw());
52
+        dealerHand.add(deck.draw());
53
+
54
+        int expected = 2;
55
+        int actual = blackJack.getPlayer(0).getDealerHand().size();
56
+
57
+        Assert.assertEquals(expected, actual);
58
+    }
59
+
60
+    @Test (expected = IllegalStateException.class)
61
+    public void testGetDealerHand_NotDealer() {
62
+        testHand.add(deck.draw());
63
+        testHand.add(deck.draw());
64
+        testHand.add(deck.draw());
65
+
66
+        testPlayer.getDealerHand();
67
+    }
68
+}

src/test/java/io/zipcoder/casino/BlackJackTest.java → src/test/java/io/zipcoder/casino/CardGame/BlackJack/BlackJackTest.java View File

@@ -1,16 +1,15 @@
1
-package io.zipcoder.casino;
1
+package io.zipcoder.casino.CardGame.BlackJack;
2 2
 
3
-import io.zipcoder.casino.CardGame.BlackJack.BlackJack;
4
-import io.zipcoder.casino.CardGame.BlackJack.BlackJackPlayer;
5 3
 import io.zipcoder.casino.CardGame.Card;
6 4
 import io.zipcoder.casino.CardGame.Deck;
7 5
 import io.zipcoder.casino.CardGame.Face;
8 6
 import io.zipcoder.casino.CardGame.Suit;
7
+import io.zipcoder.casino.Player;
9 8
 import org.junit.Assert;
10 9
 import org.junit.Test;
11 10
 
12
-import java.lang.reflect.Array;
13 11
 import java.util.ArrayList;
12
+import java.util.Scanner;
14 13
 
15 14
 public class BlackJackTest {
16 15
 
@@ -32,6 +31,40 @@ public class BlackJackTest {
32 31
     }
33 32
 
34 33
     @Test
34
+    public void testHitAgain_NoBust() {
35
+        Card ace = new Card(Suit.HEARTS, Face.ACE);
36
+        Card two = new Card(Suit.HEARTS, Face.TWO);
37
+        Card six = new Card(Suit.HEARTS, Face.SIX);
38
+        testHand.add(ace);
39
+        testHand.add(two);
40
+        testHand.add(six);
41
+
42
+        deck.shuffle();
43
+        blackJack.hit(testPlayer);
44
+
45
+        boolean expected = false;
46
+        boolean actual = (testPlayer.getHandValue() > 21);
47
+
48
+        Assert.assertEquals(expected, actual);
49
+    }
50
+
51
+    @Test
52
+    public void testHitAgain_BustOrWin() {
53
+        Card queen = new Card(Suit.HEARTS, Face.QUEEN);
54
+        Card king = new Card(Suit.HEARTS, Face.KING);
55
+        testHand.add(queen);
56
+        testHand.add(king);
57
+
58
+        deck.shuffle();
59
+        blackJack.hit(testPlayer);
60
+
61
+        boolean expected = true;
62
+        boolean actual = (testPlayer.getHandValue() >= 21);
63
+
64
+        Assert.assertEquals(expected, actual);
65
+    }
66
+
67
+    @Test
35 68
     public void testSplit() {
36 69
         blackJack.setJustDealt(true);
37 70
         Card seven1 = new Card(Suit.HEARTS, Face.SEVEN);
@@ -48,6 +81,19 @@ public class BlackJackTest {
48 81
         Assert.assertEquals(expected, actual);
49 82
     }
50 83
 
84
+
85
+    @Test
86
+    public void testDoubleDown() {
87
+        blackJack.setJustDealt(true);
88
+        testPlayer.setInitialBet(blackJack.betAmount(50, testPlayer));
89
+        blackJack.doubleDown(testPlayer);
90
+
91
+        int expected = 100;
92
+        int actual = testPlayer.getBetPot();
93
+
94
+        Assert.assertEquals(expected, actual);
95
+    }
96
+
51 97
     @Test
52 98
     public void testDeal_player() {
53 99
         blackJack.deal();
@@ -138,43 +184,25 @@ public class BlackJackTest {
138 184
     }
139 185
 
140 186
     @Test
141
-    public void testDoubleDown() {
142
-        blackJack.setJustDealt(true);
143
-        testPlayer.setInitialBet(blackJack.betAmount(50, testPlayer));
144
-        blackJack.doubleDown(testPlayer);
145
-
146
-        int expected = 100;
147
-        int actual = testPlayer.getBetPot();
148
-
149
-        Assert.assertEquals(expected, actual);
150
-    }
151
-
152
-    @Test
153
-    public void testPlayerHasAce_True() {
154
-        Card ace = new Card(Suit.HEARTS, Face.ACE);
155
-
156
-        testHand.add(ace);
157
-        testHand.add(deck.draw());
158
-        testHand.add(deck.draw());
187
+    public void testAddPlayer() {
188
+        Player newPlayer = new Player("Dwight White");
189
+        blackJack.addPlayer(newPlayer);
159 190
 
160
-        boolean expected = true;
161
-        boolean actual = testPlayer.hasAce();
191
+        int expected = 3;
192
+        int actual = blackJack.getBlackJackPlayers().size();
162 193
 
163 194
         Assert.assertEquals(expected, actual);
164 195
     }
165 196
 
166 197
     @Test
167
-    public void testPlayerHasAce_False() {
168
-        testHand.add(deck.draw());
169
-        testHand.add(deck.draw());
170
-        testHand.add(deck.draw());
198
+    public void testRemovePlayer() {
199
+        Player newPlayer = new Player("Dwight White");
200
+        blackJack.addPlayer(newPlayer);
201
+        blackJack.removePlayer(newPlayer);
171 202
 
172
-        boolean expected = false;
173
-        boolean actual = testPlayer.hasAce();
203
+        int expected = 2;
204
+        int actual = blackJack.getBlackJackPlayers().size();
174 205
 
175 206
         Assert.assertEquals(expected, actual);
176 207
     }
177
-
178
-
179
-
180 208
 }

+ 158
- 0
src/test/java/io/zipcoder/casino/CardGame/BlackJack/Test_BlackJackGame.java View File

@@ -0,0 +1,158 @@
1
+package io.zipcoder.casino.CardGame.BlackJack;
2
+
3
+import io.zipcoder.casino.Player;
4
+
5
+import java.util.ArrayList;
6
+import java.util.Scanner;
7
+
8
+public class Test_BlackJackGame {
9
+
10
+    public static void main(String[] args) {
11
+//        Player player = new Player("Theta Thunder the III");
12
+//        Scanner scanner = new Scanner(System.in);
13
+//
14
+        Player player = new Player("Theta Thunder the III");
15
+        BlackJack blackJack = new BlackJack(player);
16
+//
17
+//        BlackJackPlayer blackJackPlayer = blackJack.getPlayer(1);
18
+//        BlackJackPlayer dealer = blackJack.getDealer();
19
+//
20
+//        BlackJackPlayer activePlayer;
21
+//
22
+        System.out.println("\nWelcome to BlackJack!\n\nThe minimum bet is $50.");
23
+        blackJack.start();
24
+//
25
+//        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nGAME START - DEALING CARDS");
26
+//        blackJack.deal();
27
+//
28
+//        int turnNumber = blackJack.getNumOfTurns();
29
+//        int stands = blackJack.getStands();
30
+//
31
+//        boolean flag = true;
32
+//
33
+//        while (flag) {
34
+//            if (turnNumber % 2 == 1) {
35
+//                activePlayer = dealer;
36
+//            } else {
37
+//                activePlayer = blackJackPlayer;
38
+//            }
39
+//
40
+//            ArrayList<Integer> handValue = blackJack.countPlayerHand(activePlayer);
41
+//
42
+//            if (blackJack.getJustDealt()) {
43
+//                if (dealer.getHandValue() == 21) {
44
+//                    System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\n" + blackJack.formatHand(dealer.getPlayerHand()) + "\n\nDealer's Hand Value: " + dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nBlackjack! Dealer wins!");
45
+//                    player.setWallet(player.getWallet() - (blackJackPlayer.getBetPot() * 2));
46
+//                    System.out.println("\nYou Lost $" + blackJackPlayer.getBetPot() * 2 + "\nCurrent Wallet: $" + player.getWallet());
47
+//                    flag = false;
48
+//                } else if (blackJackPlayer.getHandValue() == 21) {
49
+//                    System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Hand: \n\n" + blackJack.formatHand(blackJackPlayer.getPlayerHand()) + "\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nBlackjack! Player wins!");
50
+//                    player.setWallet(player.getWallet() + (blackJackPlayer.getBetPot() * 2));
51
+//                    System.out.println("\nYou Won $" + blackJackPlayer.getBetPot() * 2 + "\nCurrent Wallet: $" + player.getWallet());
52
+//                    flag = false;
53
+//                }
54
+//            }
55
+//
56
+//            if (activePlayer == blackJackPlayer && stands < 2) {
57
+//
58
+//                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\nMYSTERY-CARD || " + blackJack.formatHand(dealer.getDealerHand()) + "\n\nDealer's Hand Value: ??" +
59
+//                        "\n\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Hand: \n\n" + blackJack.formatHand(blackJackPlayer.getPlayerHand()) + "\n\nYour Hand Value: " + blackJack.formatHandValue(handValue) +
60
+//                        "\n\n~~~~~~~~~~~~~~~~~~~\n\nYOUR TURN" + "\n\n~~~~~~~~~~~~~~~~~~~\n\nWhat do you want to do?\n<< Hit - Stand - Double Down - Split - Quit >>");
61
+//                String inputResponse = scanner.nextLine();
62
+//                String response = inputResponse.toUpperCase();
63
+//
64
+//                switch (response) {
65
+//                    case "HIT":
66
+//                        blackJack.hit(blackJackPlayer);
67
+//
68
+//                        if (blackJackPlayer.getHandValue() > 21) {
69
+//                            System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Hand: \n\n" + blackJack.formatHand(blackJackPlayer.getPlayerHand()) + "\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nToo high, you lose!");
70
+//                            player.setWallet(player.getWallet() - blackJackPlayer.getBetPot());
71
+//                            System.out.println("\nYou Lost $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + player.getWallet());
72
+//                            flag = false;
73
+//                        } else if (blackJackPlayer.getHandValue() == 21) {
74
+//                            System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Hand: \n\n" + blackJack.formatHand(blackJackPlayer.getPlayerHand()) + "\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nYou win!!! YAYAYAYAYAYAYYAYAYAYAYAYYY");
75
+//                            player.setWallet(player.getWallet() + blackJackPlayer.getBetPot());
76
+//                            System.out.println("\nYou Won $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + player.getWallet());
77
+//                            flag = false;
78
+//                        }
79
+//                        break;
80
+//                    case "STAND":
81
+//                        blackJack.setNumOfTurns(turnNumber++);
82
+//                        blackJack.stand();
83
+//                        stands++;
84
+//                        break;
85
+//                    case "DOUBLE DOWN":
86
+//                        blackJack.doubleDown(activePlayer);
87
+//                        break;
88
+//                    case "SPLIT":
89
+//                        blackJack.split(activePlayer);
90
+//                        break;
91
+//                    case "QUIT":
92
+//                        flag = false;
93
+//                        break;
94
+//                    default:
95
+//                        System.out.println("Input unknown, please try again");
96
+//                        break;
97
+//                }
98
+//            } else if (activePlayer == dealer && stands < 2) {
99
+//
100
+//                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDEALER'S TURN");
101
+//
102
+//                if (dealer.getHandValue() > 15 && dealer.getHandValue() < 21) {
103
+//                    blackJack.setNumOfTurns(turnNumber++);
104
+//                    blackJack.stand();
105
+//                } else {
106
+//                    blackJack.hit(dealer);
107
+//
108
+//                    if (dealer.getHandValue() > 21) {
109
+//                        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\n" + blackJack.formatHand(dealer.getPlayerHand()) + "\n\nDealer's Hand Value: " + dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nDealer bust, you win!");
110
+//                        player.setWallet(player.getWallet() + blackJackPlayer.getBetPot());
111
+//                        System.out.println("\nYou Won $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + player.getWallet());
112
+//                        flag = false;
113
+//                    } else if (dealer.getHandValue() == 21) {
114
+//                        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\n" + blackJack.formatHand(dealer.getPlayerHand()) + "\n\nDealer's Hand Value: " + dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nBlackjack! Dealer wins!");
115
+//                        player.setWallet(player.getWallet() - blackJackPlayer.getBetPot());
116
+//                        System.out.println("\nYou Lost $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + player.getWallet());
117
+//                        flag = false;
118
+//                    } else if (handValue.get(0) < 21 || (handValue.size() > 2 && handValue.get(1) < 21)) {
119
+//                        blackJack.setNumOfTurns(turnNumber++);
120
+//                        blackJack.stand();
121
+//                    }
122
+//                }
123
+//                stands++;
124
+//
125
+//            } else if (stands == 2) {
126
+//                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\n  ...............\n  ...............\n  ...............\n  ...............\n  ...............\n  ...............\n    Calculating\n  ...............\n  ...............\n  ...............\n  ...............\n  ...............\n  ...............\n");
127
+//
128
+//                if (blackJackPlayer.getHandValue() > dealer.getHandValue()) {
129
+//                    System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\nDealer's Hand Value: " + dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nYou win!");
130
+//                    player.setWallet(player.getWallet() + blackJackPlayer.getBetPot());
131
+//                    System.out.println("\nYou Won $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + player.getWallet());
132
+//                } else if (blackJackPlayer.getHandValue() < dealer.getHandValue()) {
133
+//                    System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\nDealer's Hand Value: " + dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nDealer wins! You lose!");
134
+//                    player.setWallet(player.getWallet() - blackJackPlayer.getBetPot());
135
+//                    System.out.println("\nYou Lost $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + player.getWallet());
136
+//                } else if (blackJackPlayer.getHandValue() == dealer.getHandValue()) {
137
+//                    System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\nDealer's Hand Value: " + dealer.getHandValue() + "\n\n~~~~~~~~~~~~~~~~~~~\n\nTie, no one wins");
138
+//                    System.out.println("\nCurrent Wallet: $" + player.getWallet());
139
+//                }
140
+//                flag = false;
141
+//            }
142
+//        }
143
+//
144
+//        System.out.println("Would you like to play again?\n\n<<YES - NO>>");
145
+//        String userInput = scanner.nextLine();
146
+//        String input = userInput.toUpperCase();
147
+//
148
+//        switch (input) {
149
+//            case "YES":
150
+//                blackJack.start();
151
+//                break;
152
+//            case "NO":
153
+//                System.out.println("BYYYYEEEEEE");
154
+//                // go back to casino
155
+//                break;
156
+//        }
157
+    }
158
+}

+ 56
- 0
src/test/java/io/zipcoder/casino/CrapsTest.java View File

@@ -18,6 +18,62 @@ public class CrapsTest {
18 18
         Assert.assertTrue((2 < actual) && (actual < 12));
19 19
     }
20 20
 
21
+    @Test
22
+    public void testGamePlay(){
23
+        game1.gamePlay();
24
+    }
25
+
26
+    @Test
27
+    public void testFirstRoll(){
28
+
29
+
30
+    }
31
+
32
+    @Test
33
+    public void testRemainingRolls(){
34
+
35
+    }
36
+
37
+    @Test
38
+    public void testWin(){
39
+
40
+    }
41
+
42
+    @Test
43
+    public void testLose(){
44
+
45
+    }
46
+
47
+    @Test
48
+    public void testEnd(){
49
+
50
+    }
51
+
52
+    @Test
53
+    public void testGetPointer(){
54
+
55
+    }
56
+
57
+    @Test
58
+    public void testSetPointer(){
59
+
60
+    }
61
+
62
+    @Test
63
+    public void testAddPlayer(){
64
+
65
+    }
66
+
67
+    @Test
68
+    public void testRemovePlayer(){
69
+
70
+    }
71
+
72
+    @Test
73
+    public void testExitTable(){
74
+
75
+    }
76
+
21 77
 
22 78
 
23 79