Browse Source

Merge branch 'Working' into devCraps

updated
Connor Dunnigan 6 years ago
parent
commit
39481c3dd8
23 changed files with 174 additions and 171 deletions
  1. 30
    22
      src/main/java/io/zipcoder/casino/Casino.java
  2. 17
    15
      src/main/java/io/zipcoder/casino/cardgames/BlackJack.java
  3. 0
    24
      src/main/java/io/zipcoder/casino/cardgames/CardGame.java
  4. 15
    3
      src/main/java/io/zipcoder/casino/cardgames/GoFish.java
  5. 0
    53
      src/main/java/io/zipcoder/casino/cardgames/cards/Deck.java
  6. 9
    4
      src/main/java/io/zipcoder/casino/dicegames/Craps.java
  7. 0
    18
      src/main/java/io/zipcoder/casino/dicegames/DiceGame.java
  8. 2
    2
      src/main/java/io/zipcoder/casino/player/BlackJackPlayer.java
  9. 1
    1
      src/main/java/io/zipcoder/casino/player/CrapsPlayer.java
  10. 2
    2
      src/main/java/io/zipcoder/casino/player/GoFishPlayer.java
  11. 4
    1
      src/main/java/io/zipcoder/casino/utilities/Card.java
  12. 2
    0
      src/main/java/io/zipcoder/casino/utilities/Console.java
  13. 1
    4
      src/main/java/io/zipcoder/casino/utilities/Dice.java
  14. 0
    17
      src/main/java/io/zipcoder/casino/utilities/Game.java
  15. 22
    0
      src/main/java/io/zipcoder/casino/utilities/abstracts/CardGame.java
  16. 15
    0
      src/main/java/io/zipcoder/casino/utilities/abstracts/DiceGame.java
  17. 13
    0
      src/main/java/io/zipcoder/casino/utilities/abstracts/Game.java
  18. 2
    2
      src/main/java/io/zipcoder/casino/utilities/containers/CardHand.java
  19. 24
    0
      src/main/java/io/zipcoder/casino/utilities/containers/Deck.java
  20. 1
    1
      src/main/java/io/zipcoder/casino/utilities/enums/CardSuit.java
  21. 1
    1
      src/main/java/io/zipcoder/casino/utilities/enums/CardValue.java
  22. 1
    1
      src/main/java/io/zipcoder/casino/utilities/interfaces/Gamble.java
  23. 12
    0
      src/test/java/io/zipcoder/casino/CasinoTest.java

+ 30
- 22
src/main/java/io/zipcoder/casino/Casino.java View File

7
 import io.zipcoder.casino.player.Player;
7
 import io.zipcoder.casino.player.Player;
8
 import io.zipcoder.casino.player.Players;
8
 import io.zipcoder.casino.player.Players;
9
 import io.zipcoder.casino.utilities.Console;
9
 import io.zipcoder.casino.utilities.Console;
10
-import io.zipcoder.casino.utilities.Game;
11
-
12
-import java.lang.reflect.Array;
13
-import java.util.Arrays;
10
+import io.zipcoder.casino.utilities.abstracts.Game;
14
 
11
 
15
 public class Casino {
12
 public class Casino {
16
     private Game game;
13
     private Game game;
31
     }
28
     }
32
 
29
 
33
     public void enterPlayers() {
30
     public void enterPlayers() {
34
-      int numberOfPlayers = console.getIntegerInput("WELCOME TO EPSILON CASINO, CALLED \"ALMOST A CASINO\" ON YELP\n" +
35
-              "PLEASE ENTER A NUMBER OF PLAYERS.");
36
-      String playerNames = "";
37
-      for (int i = 1; i <= numberOfPlayers; i++) {
38
-        String nameOfPlayer = console.getStringInput("PLAYER " + i + ": WHAT IS YOUR NAME?\n");
39
-        players.addPlayer(new Player(nameOfPlayer));
40
-        playerNames += nameOfPlayer + ", ";
41
-      }
42
-      console.println(playerNames + "THANK YOU FOR JOINING US");
31
+        int numberOfPlayers = getNumberOfPlayers();
32
+        String playerNames = "";
33
+        playerNames = getPlayerNames(numberOfPlayers, playerNames);
34
+        console.println(playerNames + "THANK YOU FOR JOINING US");
35
+    }
36
+
37
+    private String getPlayerNames(int numberOfPlayers, String playerNames) {
38
+        for (int i = 1; i <= numberOfPlayers; i++) {
39
+          String nameOfPlayer = console.getStringInput("PLAYER " + i + ": WHAT IS YOUR NAME?\n");
40
+          players.addPlayer(new Player(nameOfPlayer));
41
+          playerNames += nameOfPlayer + ", ";
42
+        }
43
+        return playerNames;
44
+    }
45
+
46
+    private int getNumberOfPlayers() {
47
+        return console.getIntegerInput("WELCOME TO EPSILON CASINO, CALLED \"ALMOST A CASINO\" ON YELP\n" +
48
+                  "PLEASE ENTER A NUMBER OF PLAYERS.");
43
     }
49
     }
44
 
50
 
45
     public void chooseTable() {
51
     public void chooseTable() {
52
       Integer number=console.getIntegerInput("") ;
58
       Integer number=console.getIntegerInput("") ;
53
        switch(number){
59
        switch(number){
54
          case 1:
60
          case 1:
55
-              console.println("WELCOME TO CRAPS\n") ;
56
-              game = new Craps();
57
-              break;
61
+             runGame(new Craps());
62
+             break;
58
         case 2:
63
         case 2:
59
-              console.println("WELCOME TO BLACK JACK\n") ;
60
-              game = new BlackJack();
61
-              break;
64
+             runGame(new BlackJack());
65
+             break;
62
         case 3:
66
         case 3:
63
-              console.println("WELCOME TO GO FISH\n");
64
-              game = new GoFish();
65
-              break;
67
+             runGame(new GoFish());
68
+             break;
66
        }        
69
        }        
67
      }
70
      }
68
 
71
 
72
+    private void runGame(Game game) {
73
+        console.println("WELCOME TO %s", game.getClassName());
74
+        this.game = game;
75
+    }
76
+
69
     public void confirmPlayers() {
77
     public void confirmPlayers() {
70
       boolean isConfirmed = false;
78
       boolean isConfirmed = false;
71
       while(!isConfirmed){
79
       while(!isConfirmed){

+ 17
- 15
src/main/java/io/zipcoder/casino/cardgames/BlackJack.java View File

1
 package io.zipcoder.casino.cardgames;
1
 package io.zipcoder.casino.cardgames;
2
 
2
 
3
-import io.zipcoder.casino.cardgames.cards.Card;
4
-import io.zipcoder.casino.cardgames.cards.CardHand;
5
-import io.zipcoder.casino.cardgames.cards.CardValue;
6
-import io.zipcoder.casino.cardgames.cards.Deck;
3
+import io.zipcoder.casino.utilities.Card;
4
+import io.zipcoder.casino.utilities.abstracts.CardGame;
5
+import io.zipcoder.casino.utilities.containers.CardHand;
6
+import io.zipcoder.casino.utilities.containers.Deck;
7
 import io.zipcoder.casino.utilities.Console;
7
 import io.zipcoder.casino.utilities.Console;
8
-import io.zipcoder.casino.utilities.Gamble;
8
+import io.zipcoder.casino.utilities.interfaces.Gamble;
9
 import io.zipcoder.casino.player.BlackJackPlayer;
9
 import io.zipcoder.casino.player.BlackJackPlayer;
10
 import io.zipcoder.casino.player.Player;
10
 import io.zipcoder.casino.player.Player;
11
 import io.zipcoder.casino.player.Players;
11
 import io.zipcoder.casino.player.Players;
12
 
12
 
13
-import java.sql.SQLOutput;
14
 import java.util.ArrayList;
13
 import java.util.ArrayList;
15
-import java.util.Vector;
16
 
14
 
17
 public class BlackJack extends CardGame implements Gamble {
15
 public class BlackJack extends CardGame implements Gamble {
18
 
16
 
25
     public BlackJack(){
23
     public BlackJack(){
26
         readyPlayers();
24
         readyPlayers();
27
         dealCards(2);
25
         dealCards(2);
28
-        for (BlackJackPlayer p : blackJackPlayers) {
29
-          run();
30
-        }
26
+        runGame();
31
     }
27
     }
32
 
28
 
33
     public void readyPlayers() {
29
     public void readyPlayers() {
36
         }
32
         }
37
     }
33
     }
38
 
34
 
39
-    public void run(){
35
+    @Override
36
+    public void runGame(){
40
         for(int i = 0; i < blackJackPlayers.size(); i++){
37
         for(int i = 0; i < blackJackPlayers.size(); i++){
41
             play(blackJackPlayers.get(i),blackJackPlayers.get(i).getBet());
38
             play(blackJackPlayers.get(i),blackJackPlayers.get(i).getBet());
42
         }
39
         }
76
 
73
 
77
             while (getSum(currentPlayer.getHand()) < 21) {
74
             while (getSum(currentPlayer.getHand()) < 21) {
78
                 if (hitOrStand.equalsIgnoreCase("H")) {
75
                 if (hitOrStand.equalsIgnoreCase("H")) {
79
-                    dealCard(currentPlayer,1);
76
+                    dealCards(currentPlayer,1);
80
                 } else if (hitOrStand.equalsIgnoreCase("S")) {
77
                 } else if (hitOrStand.equalsIgnoreCase("S")) {
81
                     break;
78
                     break;
82
                 } else {
79
                 } else {
119
         }
116
         }
120
 
117
 
121
 }
118
 }
122
-
119
+    @Override
123
     public void dealCards(int numberOfCards) {
120
     public void dealCards(int numberOfCards) {
124
 
121
 
125
         for(BlackJackPlayer p: blackJackPlayers){ //deal 2 cards to each player
122
         for(BlackJackPlayer p: blackJackPlayers){ //deal 2 cards to each player
130
         }
127
         }
131
     }
128
     }
132
 
129
 
133
-    public void dealCard(BlackJackPlayer p, int numberOfCards) {
130
+    @Override
131
+    public void dealCards(Player p, int numberOfCards) {
132
+        BlackJackPlayer bjp = (BlackJackPlayer) p;
134
         for (int i = 0; i < numberOfCards; i++) {
133
         for (int i = 0; i < numberOfCards; i++) {
135
             Card card = deck.removeFirst();
134
             Card card = deck.removeFirst();
136
-            p.getHand().add(card);
135
+            bjp.getHand().add(card);
137
         }
136
         }
138
     }
137
     }
139
 
138
 
181
         dealerHand.add(newCard);
180
         dealerHand.add(newCard);
182
     }
181
     }
183
 
182
 
183
+    @Override
184
+    public void promptContinue(){};
185
+
184
 
186
 
185
 }
187
 }

+ 0
- 24
src/main/java/io/zipcoder/casino/cardgames/CardGame.java View File

1
-package io.zipcoder.casino.cardgames;
2
-
3
-import io.zipcoder.casino.cardgames.cards.CardHand;
4
-import io.zipcoder.casino.cardgames.cards.Deck;
5
-import io.zipcoder.casino.utilities.Game;
6
-import io.zipcoder.casino.player.Player;
7
-
8
-public class CardGame extends Game {
9
-
10
-    Deck deck = new Deck();
11
-
12
-    void dealCards(Player player, int numberOfCards) {
13
-
14
-    }
15
-
16
-    public void playCard() {
17
-
18
-    }
19
-
20
-    void revealCard() {
21
-
22
-    }
23
-
24
-}

+ 15
- 3
src/main/java/io/zipcoder/casino/cardgames/GoFish.java View File

1
 package io.zipcoder.casino.cardgames;
1
 package io.zipcoder.casino.cardgames;
2
 
2
 
3
-import io.zipcoder.casino.cardgames.cards.Deck;
3
+import io.zipcoder.casino.utilities.abstracts.CardGame;
4
+import io.zipcoder.casino.utilities.containers.Deck;
4
 import io.zipcoder.casino.player.GoFishPlayer;
5
 import io.zipcoder.casino.player.GoFishPlayer;
5
 import io.zipcoder.casino.player.Player;
6
 import io.zipcoder.casino.player.Player;
6
 import io.zipcoder.casino.player.Players;
7
 import io.zipcoder.casino.player.Players;
21
         runGame();
22
         runGame();
22
     }
23
     }
23
 
24
 
25
+    @Override
26
+    public void runGame(){
27
+
28
+    }
29
+
24
     public void readyPlayers() {
30
     public void readyPlayers() {
25
         for (Player player : Players.getInstance().getPlayers()) {
31
         for (Player player : Players.getInstance().getPlayers()) {
26
             goFishPlayers.add(new GoFishPlayer(player));
32
             goFishPlayers.add(new GoFishPlayer(player));
38
     }
44
     }
39
 
45
 
40
     @Override
46
     @Override
41
-    void dealCards(Player player, int numberOfCards) {
42
-        super.dealCards(player, numberOfCards);
47
+    public void dealCards(Player player, int numberOfCards) {
43
         // dealPile = dealPile - numberOfCards;
48
         // dealPile = dealPile - numberOfCards;
44
     }
49
     }
45
 
50
 
51
+    @Override
52
+    public void dealCards(int numberOfCards) {
53
+
54
+    }
55
+
56
+    @Override
57
+    public void promptContinue(){};
46
     //
58
     //
47
     public void updateDrawPile() {
59
     public void updateDrawPile() {
48
 
60
 

+ 0
- 53
src/main/java/io/zipcoder/casino/cardgames/cards/Deck.java View File

1
-package io.zipcoder.casino.cardgames.cards;
2
-
3
-import io.zipcoder.casino.utilities.Console;
4
-
5
-
6
-import java.util.ArrayDeque;
7
-import java.util.ArrayList;
8
-import java.util.Collections;
9
-import java.util.Deque;
10
-
11
-public class Deck extends ArrayDeque<Card> {
12
-    // private ArrayList<Card> deck;
13
-
14
-    public Deck(){
15
-        ArrayList<Card> freshDeck = new ArrayList<>();
16
-        for (int i = 0; i < 13; i++){
17
-            CardValue value = CardValue.values()[i];
18
-
19
-            for (int j =0; j < 4;j++){
20
-                Card card = new Card (value, CardSuit.values()[j]);
21
-                freshDeck.add(card);
22
-            }
23
-        }
24
-
25
-        Collections.shuffle(freshDeck);
26
-
27
-        this.addAll(freshDeck);
28
-
29
-//        for (Card aCard : this) {
30
-//            Card oneCard = aCard;
31
-//
32
-////            Console.println(oneCard.getCardValue() + " of " + oneCard.getSuit());
33
-////            CardValue.values();
34
-//
35
-//        }
36
-    }
37
-
38
-    public static void main(String[] args) {
39
-//        CardValue[] cards = CardValue.values();
40
-//        for (CardValue value : cards) {
41
-//            System.out.println(value.getCardValue());
42
-//        }
43
-        Deck deck = new Deck();
44
-        int cardCount = 0;
45
-        for (Card card : deck) {
46
-            cardCount++;
47
-//            System.out.println(card.getCardValue() + " " + card.getSuit());
48
-        }
49
-
50
-    }
51
-
52
-
53
-}

+ 9
- 4
src/main/java/io/zipcoder/casino/dicegames/Craps.java View File

1
 package io.zipcoder.casino.dicegames;
1
 package io.zipcoder.casino.dicegames;
2
 
2
 
3
 import io.zipcoder.casino.utilities.Console;
3
 import io.zipcoder.casino.utilities.Console;
4
-import io.zipcoder.casino.utilities.Gamble;
4
+import io.zipcoder.casino.utilities.interfaces.Gamble;
5
 import io.zipcoder.casino.player.CrapsPlayer;
5
 import io.zipcoder.casino.player.CrapsPlayer;
6
 import io.zipcoder.casino.player.Player;
6
 import io.zipcoder.casino.player.Player;
7
 import io.zipcoder.casino.player.Players;
7
 import io.zipcoder.casino.player.Players;
8
+import io.zipcoder.casino.utilities.abstracts.DiceGame;
8
 
9
 
9
 import java.util.ArrayList;
10
 import java.util.ArrayList;
10
 
11
 
15
 
16
 
16
     public Craps() {
17
     public Craps() {
17
         readyPlayers();
18
         readyPlayers();
18
-        run();
19
+        runGame();
19
     }
20
     }
20
     //for test purposes
21
     //for test purposes
21
     public Craps(ArrayList<CrapsPlayer> playerz){
22
     public Craps(ArrayList<CrapsPlayer> playerz){
22
         crapsPlayers.addAll(playerz);
23
         crapsPlayers.addAll(playerz);
23
-        run();
24
+        runGame();
24
     }
25
     }
25
 
26
 
26
     public void readyPlayers() {
27
     public void readyPlayers() {
29
         }
30
         }
30
     }
31
     }
31
 
32
 
32
-    public void run(){
33
+    @Override
34
+    public void runGame(){
33
         for(int i = 0; i < crapsPlayers.size(); i++){
35
         for(int i = 0; i < crapsPlayers.size(); i++){
34
             greetPlayer(crapsPlayers.get(i).getP());
36
             greetPlayer(crapsPlayers.get(i).getP());
35
             play(crapsPlayers.get(i));
37
             play(crapsPlayers.get(i));
112
     public void promptEnterKey(String str){
114
     public void promptEnterKey(String str){
113
         String input = console.getStringInput("\nPress \"ENTER\" to " + str);
115
         String input = console.getStringInput("\nPress \"ENTER\" to " + str);
114
     }
116
     }
117
+
118
+    @Override
119
+    public void promptContinue(){};
115
 }
120
 }

+ 0
- 18
src/main/java/io/zipcoder/casino/dicegames/DiceGame.java View File

1
-package io.zipcoder.casino.dicegames;
2
-
3
-import io.zipcoder.casino.dicegames.dice.Dice;
4
-import io.zipcoder.casino.utilities.Game;
5
-
6
-public class DiceGame extends Game {
7
-
8
-    private Dice dice = new Dice(1);
9
-
10
-    public void rollDie() {
11
-    }
12
-    public int rollDie(int num) {
13
-        Dice dice = new Dice(num);
14
-        int sum = dice.tossAndSum();
15
-        return sum;
16
-    }
17
-
18
-}

+ 2
- 2
src/main/java/io/zipcoder/casino/player/BlackJackPlayer.java View File

1
 package io.zipcoder.casino.player;
1
 package io.zipcoder.casino.player;
2
 
2
 
3
-import io.zipcoder.casino.cardgames.cards.CardHand;
3
+import io.zipcoder.casino.utilities.containers.CardHand;
4
 
4
 
5
-public class BlackJackPlayer{
5
+public class BlackJackPlayer extends Player{
6
     private CardHand hand;
6
     private CardHand hand;
7
     Player blackJackPlayer;
7
     Player blackJackPlayer;
8
     private long bet;
8
     private long bet;

+ 1
- 1
src/main/java/io/zipcoder/casino/player/CrapsPlayer.java View File

1
 package io.zipcoder.casino.player;
1
 package io.zipcoder.casino.player;
2
 
2
 
3
-public class CrapsPlayer  {
3
+public class CrapsPlayer extends Player {
4
     Player crapsPlayer;
4
     Player crapsPlayer;
5
     long bet;
5
     long bet;
6
 
6
 

+ 2
- 2
src/main/java/io/zipcoder/casino/player/GoFishPlayer.java View File

1
 package io.zipcoder.casino.player;
1
 package io.zipcoder.casino.player;
2
 
2
 
3
-import io.zipcoder.casino.cardgames.cards.CardHand;
3
+import io.zipcoder.casino.utilities.containers.CardHand;
4
 
4
 
5
-public class GoFishPlayer {
5
+public class GoFishPlayer extends Player{
6
     private CardHand hand;
6
     private CardHand hand;
7
 
7
 
8
     Player goFishPlayer;
8
     Player goFishPlayer;

src/main/java/io/zipcoder/casino/cardgames/cards/Card.java → src/main/java/io/zipcoder/casino/utilities/Card.java View File

1
-package io.zipcoder.casino.cardgames.cards;
1
+package io.zipcoder.casino.utilities;
2
+
3
+import io.zipcoder.casino.utilities.enums.CardSuit;
4
+import io.zipcoder.casino.utilities.enums.CardValue;
2
 
5
 
3
 public final class Card {
6
 public final class Card {
4
 
7
 

+ 2
- 0
src/main/java/io/zipcoder/casino/utilities/Console.java View File

136
         double userInput = scanner.nextDouble() ;
136
         double userInput = scanner.nextDouble() ;
137
         return userInput;
137
         return userInput;
138
     }
138
     }
139
+
140
+
139
 //
141
 //
140
 //    public Integer getPlayersInput(String prompt){
142
 //    public Integer getPlayersInput(String prompt){
141
 //        Scanner scanner = new Scanner(System.in);
143
 //        Scanner scanner = new Scanner(System.in);

src/main/java/io/zipcoder/casino/dicegames/dice/Dice.java → src/main/java/io/zipcoder/casino/utilities/Dice.java View File

1
-package io.zipcoder.casino.dicegames.dice;
1
+package io.zipcoder.casino.utilities;
2
 
2
 
3
     import java.util.ArrayList;
3
     import java.util.ArrayList;
4
     import java.util.HashMap;
4
     import java.util.HashMap;
5
-    import java.util.List;
6
     import java.util.Random;
5
     import java.util.Random;
7
 
6
 
8
     public class Dice {
7
     public class Dice {
30
             return lastRollGraphic;
29
             return lastRollGraphic;
31
         }
30
         }
32
 
31
 
33
-        //        Dice(){ this.dieCount = 1; }
34
-
35
         public Dice(int dieCount) {
32
         public Dice(int dieCount) {
36
             this.dieCount = dieCount;
33
             this.dieCount = dieCount;
37
         }
34
         }

+ 0
- 17
src/main/java/io/zipcoder/casino/utilities/Game.java View File

1
-package io.zipcoder.casino.utilities;
2
-
3
-public class Game {
4
-    public void promptContinue() {
5
-        // REMATCH (runGame), NEXT GAME (return to casino), EXIT CASINO (quit)
6
-    }
7
-
8
-    public void runGame() {
9
-        //initializes game
10
-    }
11
-
12
-    public void endGame() {
13
-        //ends game, returns to Casino prompt loop
14
-    }
15
-
16
-
17
-}

+ 22
- 0
src/main/java/io/zipcoder/casino/utilities/abstracts/CardGame.java View File

1
+package io.zipcoder.casino.utilities.abstracts;
2
+
3
+import io.zipcoder.casino.utilities.containers.Deck;
4
+import io.zipcoder.casino.player.Player;
5
+
6
+public abstract class CardGame extends Game {
7
+
8
+    Deck deck = new Deck();
9
+
10
+    public abstract void dealCards(Player player, int numberOfCards);
11
+
12
+    public void playCard() {
13
+
14
+    }
15
+
16
+    public abstract void dealCards(int numberOfCards);
17
+
18
+    void revealCard() {
19
+
20
+    }
21
+
22
+}

+ 15
- 0
src/main/java/io/zipcoder/casino/utilities/abstracts/DiceGame.java View File

1
+package io.zipcoder.casino.utilities.abstracts;
2
+
3
+import io.zipcoder.casino.utilities.Dice;
4
+
5
+public abstract class DiceGame extends Game {
6
+
7
+    private Dice dice = new Dice(1);
8
+
9
+    public int rollDie(int num) {
10
+        Dice dice = new Dice(num);
11
+        int sum = dice.tossAndSum();
12
+        return sum;
13
+    }
14
+
15
+}

+ 13
- 0
src/main/java/io/zipcoder/casino/utilities/abstracts/Game.java View File

1
+package io.zipcoder.casino.utilities.abstracts;
2
+
3
+public abstract class Game {
4
+    String className = this.getClass().getName();
5
+
6
+    public abstract void promptContinue();
7
+
8
+    public abstract void runGame();
9
+
10
+    public String getClassName() {
11
+        return className;
12
+    }
13
+}

src/main/java/io/zipcoder/casino/cardgames/cards/CardHand.java → src/main/java/io/zipcoder/casino/utilities/containers/CardHand.java View File

1
-package io.zipcoder.casino.cardgames.cards;
1
+package io.zipcoder.casino.utilities.containers;
2
 
2
 
3
-import io.zipcoder.casino.utilities.Console;
3
+import io.zipcoder.casino.utilities.Card;
4
 
4
 
5
 import java.util.ArrayList;
5
 import java.util.ArrayList;
6
 
6
 

+ 24
- 0
src/main/java/io/zipcoder/casino/utilities/containers/Deck.java View File

1
+package io.zipcoder.casino.utilities.containers;
2
+
3
+import io.zipcoder.casino.utilities.Card;
4
+import io.zipcoder.casino.utilities.enums.CardSuit;
5
+import io.zipcoder.casino.utilities.enums.CardValue;
6
+
7
+import java.util.ArrayDeque;
8
+import java.util.ArrayList;
9
+import java.util.Collections;
10
+
11
+public class Deck extends ArrayDeque<Card> {
12
+    public Deck(){
13
+        ArrayList<Card> freshDeck = new ArrayList<>();
14
+        for (int i = 0; i < 13; i++){
15
+            CardValue value = CardValue.values()[i];
16
+            for (int j =0; j < 4;j++){
17
+                Card card = new Card (value, CardSuit.values()[j]);
18
+                freshDeck.add(card);
19
+            }
20
+        }
21
+        Collections.shuffle(freshDeck);
22
+        this.addAll(freshDeck);
23
+    }
24
+}

src/main/java/io/zipcoder/casino/cardgames/cards/CardSuit.java → src/main/java/io/zipcoder/casino/utilities/enums/CardSuit.java View File

1
-package io.zipcoder.casino.cardgames.cards;
1
+package io.zipcoder.casino.utilities.enums;
2
 
2
 
3
 public enum CardSuit {
3
 public enum CardSuit {
4
     HEARTS('♥'),
4
     HEARTS('♥'),

src/main/java/io/zipcoder/casino/cardgames/cards/CardValue.java → src/main/java/io/zipcoder/casino/utilities/enums/CardValue.java View File

1
-package io.zipcoder.casino.cardgames.cards;
1
+package io.zipcoder.casino.utilities.enums;
2
 
2
 
3
 public enum CardValue {
3
 public enum CardValue {
4
     ACE(1),
4
     ACE(1),

src/main/java/io/zipcoder/casino/utilities/Gamble.java → src/main/java/io/zipcoder/casino/utilities/interfaces/Gamble.java View File

1
-package io.zipcoder.casino.utilities;
1
+package io.zipcoder.casino.utilities.interfaces;
2
 
2
 
3
 import io.zipcoder.casino.player.Player;
3
 import io.zipcoder.casino.player.Player;
4
 
4
 

+ 12
- 0
src/test/java/io/zipcoder/casino/CasinoTest.java View File

1
 package io.zipcoder.casino;
1
 package io.zipcoder.casino;
2
 
2
 
3
 
3
 
4
+import io.zipcoder.casino.utilities.Dice;
5
+import org.junit.Test;
6
+
4
 public class CasinoTest {
7
 public class CasinoTest {
8
+
9
+    @Test public void graphicTest() {
10
+        Dice dice = new Dice();
11
+
12
+        for (int i = 1; i <= 6; i++) {
13
+            System.out.println(dice.getDieGraphic(i));
14
+        }
15
+    }
16
+
5
 }
17
 }