Просмотр исходного кода

Merge branch 'working' into blackjack

ThuyKhong 6 лет назад
Родитель
Сommit
633cf12d2c

+ 25
- 9
src/main/java/io/zipcoder/casino/Casino.java Просмотреть файл

14
     Players players = Players.getInstance();
14
     Players players = Players.getInstance();
15
     Console console = new Console();
15
     Console console = new Console();
16
     boolean continueGame = true;
16
     boolean continueGame = true;
17
+    int numberOfPlayers = 0;
18
+    boolean kickedOut = false;
17
 
19
 
18
     public static void main(String[] args) {
20
     public static void main(String[] args) {
19
         Casino casino = new Casino();
21
         Casino casino = new Casino();
22
+        Console console = new Console();
20
 
23
 
21
 //before game
24
 //before game
22
         casino.enterPlayers();
25
         casino.enterPlayers();
26
+
23
         while (casino.continueGame == true) {
27
         while (casino.continueGame == true) {
24
             //ADD LOOP
28
             //ADD LOOP
25
             casino.chooseTable();
29
             casino.chooseTable();
27
 //after game
31
 //after game
28
             casino.printBalance();
32
             casino.printBalance();
29
             casino.bootPlayer();
33
             casino.bootPlayer();
34
+            if (casino.kickedOut) console.kickedOut();
35
+
36
+            casino.continueGame = casino.promptContinue();
30
         }
37
         }
31
     }
38
     }
32
 
39
 
33
     public void enterPlayers() {
40
     public void enterPlayers() {
34
-        int numberOfPlayers = getNumberOfPlayers();
41
+        numberOfPlayers = getNumberOfPlayers();
35
         String playerNames = "";
42
         String playerNames = "";
36
         playerNames = getPlayerNames(numberOfPlayers, playerNames);
43
         playerNames = getPlayerNames(numberOfPlayers, playerNames);
37
-        console.println(playerNames + "THANK YOU FOR JOINING US");
44
+        console.println("\n"+ playerNames + "THANK YOU FOR JOINING US");
38
     }
45
     }
39
 
46
 
40
     private String getPlayerNames(int numberOfPlayers, String playerNames) {
47
     private String getPlayerNames(int numberOfPlayers, String playerNames) {
48
+        console.println("");
41
         for (int i = 1; i <= numberOfPlayers; i++) {
49
         for (int i = 1; i <= numberOfPlayers; i++) {
42
           String nameOfPlayer = console.getStringInput("PLAYER " + i + ": WHAT IS YOUR NAME?");
50
           String nameOfPlayer = console.getStringInput("PLAYER " + i + ": WHAT IS YOUR NAME?");
43
           players.addPlayer(new Player(nameOfPlayer));
51
           players.addPlayer(new Player(nameOfPlayer));
47
     }
55
     }
48
 
56
 
49
     private int getNumberOfPlayers() {
57
     private int getNumberOfPlayers() {
50
-        return console.getIntegerInput("WELCOME TO EPSILON CASINO, CALLED \"ALMOST A CASINO\" ON YELP\n" +
51
-                  "PLEASE ENTER A NUMBER OF PLAYERS.");
58
+        return console.getIntegerInput("*********************************\n" +
59
+                "    WELCOME TO EPSILON CASINO\n---------------------------------\n" +
60
+                "CALLED \"ALMOST A CASINO\" ON YELP\n*********************************\n" +
61
+                "\nPLEASE ENTER A NUMBER OF PLAYERS.");
52
     }
62
     }
53
 
63
 
54
     public void chooseTable() {
64
     public void chooseTable() {
77
     public void bootPlayer() {
87
     public void bootPlayer() {
78
         // If player balance is 0, player game over
88
         // If player balance is 0, player game over
79
         for (int i = 0; i < players.getPlayers().size(); i++) {
89
         for (int i = 0; i < players.getPlayers().size(); i++) {
80
-          if(players.getPlayers().get(i).getChipBalance()<=0){
81
-            console.println(players.getPlayers().get(i).getName() + ", YOU ARE BROKE. GTFO, PEASANT.");
90
+          if(players.getPlayers().get(i).getChipBalance()<1){
91
+            console.println(players.getPlayers().get(i).getName() + ", YOU ARE BROKE. GTFO, PEASANT.\n");
82
             players.removePlayer(players.getPlayers().get(i));
92
             players.removePlayer(players.getPlayers().get(i));
93
+            i = i-1;
94
+            kickedOut = true;
83
           }
95
           }
84
         }
96
         }
97
+        this.numberOfPlayers = players.getPlayers().size();
85
     }
98
     }
86
 
99
 
87
     public void printBalance() {
100
     public void printBalance() {
90
       }
103
       }
91
     }
104
     }
92
 
105
 
93
-    public void promptContinue() {
94
-        String continueChoice = console.getStringInput("Would you like to play another game? Y/N");
95
-        if (continueChoice.equalsIgnoreCase("n")) continueGame = false;
106
+    public boolean promptContinue() {
107
+        if (numberOfPlayers > 0) {
108
+            String continueChoice = console.getStringInput("Would you like to play another game? Y/N");
109
+            if (continueChoice.equalsIgnoreCase("n")) return false;
110
+        } else return false;
111
+        return true;
96
     }
112
     }
97
 
113
 
98
 
114
 

+ 49
- 33
src/main/java/io/zipcoder/casino/cardgames/BlackJack.java Просмотреть файл

14
 
14
 
15
 public class BlackJack extends CardGame implements Gamble {
15
 public class BlackJack extends CardGame implements Gamble {
16
 
16
 
17
+    CardHand dealerHand = new CardHand();
18
+    boolean continueGame = true;
17
     private Deck deck = new Deck();
19
     private Deck deck = new Deck();
18
     private ArrayList<BlackJackPlayer> blackJackPlayers = new ArrayList<>();
20
     private ArrayList<BlackJackPlayer> blackJackPlayers = new ArrayList<>();
19
-    CardHand dealerHand = new CardHand();
20
 
21
 
21
-    public BlackJack(){
22
+    public BlackJack() {
22
         announceGameChoice();
23
         announceGameChoice();
23
         readyPlayers();
24
         readyPlayers();
24
         placePlayerBets();
25
         placePlayerBets();
33
     }
34
     }
34
 
35
 
35
     @Override
36
     @Override
36
-    public void runGame(){
37
-        for(int i = 0; i < blackJackPlayers.size(); i++){
38
-            play(blackJackPlayers.get(i),blackJackPlayers.get(i).getBet());
37
+    public void runGame() {
38
+        for (int i = 0; i < blackJackPlayers.size(); i++) {
39
+            play(blackJackPlayers.get(i), blackJackPlayers.get(i).getBet());
39
         }
40
         }
40
     }
41
     }
41
 
42
 
42
-    boolean continueGame = true;
43
     public void play(BlackJackPlayer currentPlayer, long bet) {
43
     public void play(BlackJackPlayer currentPlayer, long bet) {
44
         boolean dealerWins = false;
44
         boolean dealerWins = false;
45
 
45
 
47
         dealerWins = dealerCheck(); //TO ADD: if both player and dealer have blackjack, player keeps bet
47
         dealerWins = dealerCheck(); //TO ADD: if both player and dealer have blackjack, player keeps bet
48
         if (dealerWins == true) continueGame = false; // all players lose
48
         if (dealerWins == true) continueGame = false; // all players lose
49
 
49
 
50
-        while (continueGame == true) {
50
+        while (continueGame) {
51
             dealerDraw();
51
             dealerDraw();
52
 
52
 
53
-            Console.println("Dealer is showing a " + dealerHand.get(0).getCard()); // dealer reveals upcard
53
+            Console.println("\nDealer is showing a " + dealerHand.get(0).getCard()); // dealer reveals upcard
54
 
54
 
55
             playersTurn();
55
             playersTurn();
56
 
56
 
57
-            if (blackJackPlayers.size() < 1) continueGame = false;
57
+            continueGame = evalBusts();
58
+            if (!continueGame) break;
58
 
59
 
59
             continueGame = dealersTurn(); // IMPLEMENT: if dealer loses, all players should receive payout
60
             continueGame = dealersTurn(); // IMPLEMENT: if dealer loses, all players should receive payout
61
+            if (!continueGame) break;
60
 
62
 
61
             continueGame = evalWinner();
63
             continueGame = evalWinner();
62
         }
64
         }
67
 
69
 
68
     }
70
     }
69
 
71
 
72
+    private boolean evalBusts() {
73
+        int bustCounter = 0;
74
+        for (int i = 0; i < blackJackPlayers.size(); i++) {
75
+            if (blackJackPlayers.get(i).isPlayerBust()) bustCounter++;
76
+        }
77
+        if (blackJackPlayers.size() == bustCounter) {
78
+            return false;
79
+        } else return true;
80
+    }
81
+
70
     public boolean dealerCheck() {
82
     public boolean dealerCheck() {
71
-        if (getSum(dealerHand) == 21){
72
-            Console.println("Dealer has " +  dealerHand.display());
83
+        if (getSum(dealerHand) == 21) {
84
+            Console.println("Dealer has " + dealerHand.display());
73
             Console.println("Dealer has blackjack. Dealer wins.");
85
             Console.println("Dealer has blackjack. Dealer wins.");
74
             return true;
86
             return true;
75
         }
87
         }
82
     }
94
     }
83
 
95
 
84
     public void dealerCollectAll() {
96
     public void dealerCollectAll() {
85
-        for (BlackJackPlayer p: this.blackJackPlayers){ // collects bet from all players
97
+        for (BlackJackPlayer p : this.blackJackPlayers) { // collects bet from all players
86
             evaluateBet(p.getP(), -p.getBet());
98
             evaluateBet(p.getP(), -p.getBet());
87
         }
99
         }
88
     }
100
     }
89
 
101
 
90
     public void payoutAll() {
102
     public void payoutAll() {
91
-        for (BlackJackPlayer p: this.blackJackPlayers){ // collects bet from all players
92
-            long winnings = p.getBet()*2;
103
+        for (BlackJackPlayer p : this.blackJackPlayers) { // collects bet from all players
104
+            long winnings = p.getBet() * 2;
93
             evaluateBet(p.getP(), winnings);
105
             evaluateBet(p.getP(), winnings);
94
         }
106
         }
95
     }
107
     }
99
     }
111
     }
100
 
112
 
101
     public void placePlayerBets() {
113
     public void placePlayerBets() {
102
-        for (BlackJackPlayer p: this.blackJackPlayers){ //gets bet from each player
114
+        for (BlackJackPlayer p : this.blackJackPlayers) { //gets bet from each player
103
             Console.println(p.getName());
115
             Console.println(p.getName());
104
             placeBet(p);
116
             placeBet(p);
105
         }
117
         }
114
         for (BlackJackPlayer currentPlayer : blackJackPlayers) {
126
         for (BlackJackPlayer currentPlayer : blackJackPlayers) {
115
             if (getSum(dealerHand) == getSum(currentPlayer.getHand())) {
127
             if (getSum(dealerHand) == getSum(currentPlayer.getHand())) {
116
                 Console.println(String.format("Against %s's hand, dealer wins on a tie.", currentPlayer.getP().getName()));
128
                 Console.println(String.format("Against %s's hand, dealer wins on a tie.", currentPlayer.getP().getName()));
117
-                evaluateBet(currentPlayer.getP(), -currentPlayer.getBet());
129
+                dealerCollect(currentPlayer);
130
+            } else if (getSum(currentPlayer.getHand()) > 21) {
131
+                dealerCollect(currentPlayer);
118
             } else if (getSum(dealerHand) <= 21 && getSum(dealerHand) > getSum(currentPlayer.getHand())) {
132
             } else if (getSum(dealerHand) <= 21 && getSum(dealerHand) > getSum(currentPlayer.getHand())) {
119
                 Console.println(String.format("Against %s's hand, dealer wins.", currentPlayer.getP().getName()), currentPlayer.getP().getName());
133
                 Console.println(String.format("Against %s's hand, dealer wins.", currentPlayer.getP().getName()), currentPlayer.getP().getName());
120
-                evaluateBet(currentPlayer.getP(), -currentPlayer.getBet());
134
+                dealerCollect(currentPlayer);
121
             } else {
135
             } else {
122
                 Console.println(String.format("%s, you win!", currentPlayer.getP().getName()));
136
                 Console.println(String.format("%s, you win!", currentPlayer.getP().getName()));
123
                 evaluateBet(currentPlayer.getP(), currentPlayer.getBet());
137
                 evaluateBet(currentPlayer.getP(), currentPlayer.getBet());
136
         }
150
         }
137
 
151
 
138
         if (getSum(dealerHand) > 21) {
152
         if (getSum(dealerHand) > 21) {
139
-            Console.println("Dealer busted. You win.");
153
+            Console.println("\nDealer busted. You all win!");
140
             payoutAll();
154
             payoutAll();
141
             return false;
155
             return false;
142
         }
156
         }
150
         for (int i = 0; i < blackJackPlayers.size(); i++) {
164
         for (int i = 0; i < blackJackPlayers.size(); i++) {
151
             currentPlayer = blackJackPlayers.get(i);
165
             currentPlayer = blackJackPlayers.get(i);
152
 
166
 
153
-            Console.println(String.format("%s, you're up!", currentPlayer.getP().getName()));
167
+            Console.println(String.format("\n%s, you're up!", currentPlayer.getP().getName()));
154
             displaySumPlayerHand(currentPlayer);
168
             displaySumPlayerHand(currentPlayer);
155
 
169
 
156
             hitOrStand(currentPlayer);
170
             hitOrStand(currentPlayer);
158
     }
172
     }
159
 
173
 
160
     private boolean playerBust(BlackJackPlayer currentPlayer) {
174
     private boolean playerBust(BlackJackPlayer currentPlayer) {
161
-        if (getSum(currentPlayer.getHand()) > 21){
162
-            Console.println(currentPlayer.getP().getName() + " busted. House wins.");
163
-            dealerCollect(currentPlayer);
164
-            blackJackPlayers.remove(currentPlayer);
175
+        if (getSum(currentPlayer.getHand()) > 21) {
176
+            Console.println("\n"+currentPlayer.getP().getName() + " busted. House wins.");
177
+//            blackJackPlayers.remove(currentPlayer);
165
             return false;
178
             return false;
166
         }
179
         }
167
         return true;
180
         return true;
174
     public void hitOrStand(BlackJackPlayer currentPlayer) {
187
     public void hitOrStand(BlackJackPlayer currentPlayer) {
175
 
188
 
176
         while (getSum(currentPlayer.getHand()) < 21) {
189
         while (getSum(currentPlayer.getHand()) < 21) {
177
-            String hitOrStand = Console.getStringInput(currentPlayer.getP().getName() + ", do you want to Hit or Stand?\nEnter H for Hit or S for Stand");
190
+            String hitOrStand = Console.getStringInput(String.format("\n%s, do you want to Hit or Stand?\nEnter H for Hit or S for Stand", currentPlayer.getP().getName()));
178
 
191
 
179
             if (hitOrStand.equalsIgnoreCase("H")) {
192
             if (hitOrStand.equalsIgnoreCase("H")) {
180
                 dealCards(currentPlayer, 1);
193
                 dealCards(currentPlayer, 1);
181
-                Console.println(currentPlayer.getP().getName() + ", you have been dealt %s.", currentPlayer.getHand().get(currentPlayer.getHand().size()-1).getCard());
194
+                Console.println( "\n%s, you have been dealt %s.", currentPlayer.getP().getName(), currentPlayer.getHand().get(currentPlayer.getHand().size() - 1).getCard());
182
                 displaySumPlayerHand(currentPlayer);
195
                 displaySumPlayerHand(currentPlayer);
183
                 playerBust(currentPlayer);
196
                 playerBust(currentPlayer);
184
             } else if (hitOrStand.equalsIgnoreCase("S")) {
197
             } else if (hitOrStand.equalsIgnoreCase("S")) {
196
             if (getSum(p.getHand()) == 21) {
209
             if (getSum(p.getHand()) == 21) {
197
                 Console.println(p.getP().getName() + ", you have " + p.getHand().display());
210
                 Console.println(p.getP().getName() + ", you have " + p.getHand().display());
198
                 Console.println(p.getP().getName() + ", you have blackjack. You win!");
211
                 Console.println(p.getP().getName() + ", you have blackjack. You win!");
199
-                evaluateBet(p.getP(), p.getBet());
200
-                blackJackPlayers.remove(i);
212
+//                evaluateBet(p.getP(), p.getBet());
213
+//                blackJackPlayers.remove(i);
201
             }
214
             }
202
         }
215
         }
203
     }
216
     }
205
     @Override
218
     @Override
206
     public void dealCards(int numberOfCards) {
219
     public void dealCards(int numberOfCards) {
207
         Console.println("The dealer is dealing cards to the players.");
220
         Console.println("The dealer is dealing cards to the players.");
208
-        for(BlackJackPlayer p: blackJackPlayers){ //deal 2 cards to each player
221
+        for (BlackJackPlayer p : blackJackPlayers) { //deal 2 cards to each player
209
             for (int i = 0; i < numberOfCards; i++) {
222
             for (int i = 0; i < numberOfCards; i++) {
210
                 Card card = deck.removeFirst();
223
                 Card card = deck.removeFirst();
211
                 p.getHand().add(card);
224
                 p.getHand().add(card);
230
     }
243
     }
231
 
244
 
232
     public void evaluateBet(Player player, long payout) {
245
     public void evaluateBet(Player player, long payout) {
233
-        player.setChipBalance(player.getChipBalance()+payout);
246
+        player.setChipBalance(player.getChipBalance() + payout);
234
     }
247
     }
235
 
248
 
236
 
249
 
240
         return card;
253
         return card;
241
     }
254
     }
242
 
255
 
243
-    public int  getSum(CardHand cardHand) {
256
+    public int getSum(CardHand cardHand) {
244
         int cardSum = 0;
257
         int cardSum = 0;
245
         boolean ace = false;
258
         boolean ace = false;
246
 
259
 
255
             }
268
             }
256
             cardSum = cardSum + cardValue;
269
             cardSum = cardSum + cardValue;
257
         }
270
         }
258
-        if (cardHand.size() == 2 && ace && cardSum + 10 == 21) {
271
+        if (cardHand.size() == 2 && ace && cardSum + 10 <= 21) {
259
             cardSum = cardSum + 10;
272
             cardSum = cardSum + 10;
260
         }
273
         }
261
         return cardSum;
274
         return cardSum;
262
     }
275
     }
263
 
276
 
264
-    public void revealCard(){
277
+    public void revealCard() {
265
         Card newCard = drawCard();
278
         Card newCard = drawCard();
266
         Console.println("Dealer drew a " + newCard.getCardValue() + " of " + newCard.getSuit().getCardGraphic());
279
         Console.println("Dealer drew a " + newCard.getCardValue() + " of " + newCard.getSuit().getCardGraphic());
267
         dealerHand.add(newCard);
280
         dealerHand.add(newCard);
268
     }
281
     }
269
 
282
 
270
     @Override
283
     @Override
271
-    public void promptContinue(){};
284
+    public void promptContinue() {
285
+    }
286
+
287
+    ;
272
 
288
 
273
 }
289
 }

+ 111
- 63
src/main/java/io/zipcoder/casino/cardgames/GoFish.java Просмотреть файл

1
 package io.zipcoder.casino.cardgames;
1
 package io.zipcoder.casino.cardgames;
2
 
2
 
3
-import io.zipcoder.casino.utilities.abstracts.CardGame;
4
-import io.zipcoder.casino.utilities.containers.Deck;
5
 import io.zipcoder.casino.player.GoFishPlayer;
3
 import io.zipcoder.casino.player.GoFishPlayer;
6
 import io.zipcoder.casino.player.Player;
4
 import io.zipcoder.casino.player.Player;
7
 import io.zipcoder.casino.player.Players;
5
 import io.zipcoder.casino.player.Players;
6
+import io.zipcoder.casino.utilities.Card;
7
+import io.zipcoder.casino.utilities.Console;
8
+import io.zipcoder.casino.utilities.abstracts.CardGame;
9
+import io.zipcoder.casino.utilities.containers.Deck;
8
 
10
 
9
 import java.util.ArrayList;
11
 import java.util.ArrayList;
10
 
12
 
11
 public class GoFish extends CardGame {
13
 public class GoFish extends CardGame {
12
     private static Deck drawPile = new Deck();
14
     private static Deck drawPile = new Deck();
13
-    // Change Deck to deque;
14
     private ArrayList<GoFishPlayer> goFishPlayers = new ArrayList<>();
15
     private ArrayList<GoFishPlayer> goFishPlayers = new ArrayList<>();
15
-
16
-    public static void main(String[] args) {
17
-        System.out.println();
18
-    }
19
-
20
-    public GoFish() {
21
-        readyPlayers();
22
-        runGame();
23
-    }
24
-
25
-    @Override
26
-    public void runGame(){
27
-
28
-    }
16
+//    private int numberOfCards;
29
 
17
 
30
     public void readyPlayers() {
18
     public void readyPlayers() {
31
         for (Player player : Players.getInstance().getPlayers()) {
19
         for (Player player : Players.getInstance().getPlayers()) {
33
         }
21
         }
34
     }
22
     }
35
 
23
 
36
-    public int getNumberOfCards() {      //generate numberOfCards param for below based on number of players
24
+    @Override
25
+    public void runGame() {                                 // run the game as long as the drawPile is more than 0 cards
26
+        while (drawPile.size() >= 0) {
27
+            for (int j = 0; j < goFishPlayers.size(); j++) {
28
+                playGoFish();
29
+            }
30
+        }
31
+    }
32
+
33
+    public int getStartingCards() {                 //generate numberOfCards param for below based on number of players
37
         int numberOfCards;
34
         int numberOfCards;
38
-        if (goFishPlayers.size() <= 3) {  //RULES: For 3 players or less, deal each player 7 cards;
35
+        if (goFishPlayers.size() <= 3) {            //RULES: For 3 players or less, deal each player 7 cards;
39
             numberOfCards = 7;
36
             numberOfCards = 7;
40
-        } else {                           //RULES contd: if more than three players, deal 5 cards each.
37
+        } else {                                    //RULES contd: if more than three players, deal 5 cards each.
41
             numberOfCards = 5;
38
             numberOfCards = 5;
42
         }
39
         }
43
         return numberOfCards;
40
         return numberOfCards;
45
 
42
 
46
     @Override
43
     @Override
47
     public void dealCards(Player player, int numberOfCards) {
44
     public void dealCards(Player player, int numberOfCards) {
48
-        // dealPile = dealPile - numberOfCards;
45
+//        numberOfCards = getStartingCards();
46
+//        GoFishPlayer fishie = (GoFishPlayer) player;                    // depending on how many players
47
+//        for (int i = 0; i < numberOfCards; i++) {
48
+//            Card card = drawPile.removeFirst();
49
+//            fishie.getHand().add(card);
50
+//        }
49
     }
51
     }
50
 
52
 
51
     @Override
53
     @Override
52
     public void dealCards(int numberOfCards) {
54
     public void dealCards(int numberOfCards) {
55
+        numberOfCards = getStartingCards();
56
+        for (GoFishPlayer p : goFishPlayers) {
57
+            for (int i = 0; i < numberOfCards; i++) {
58
+                Card card = drawPile.removeFirst();
59
+                p.getHand().add(card);
60
+            }
61
+        }
62
+    }
53
 
63
 
64
+    public GoFish() {
65
+        readyPlayers();
66
+        dealCards(getStartingCards());
67
+        runGame();
54
     }
68
     }
55
 
69
 
56
     @Override
70
     @Override
57
-    public void promptContinue(){};
58
-    //
59
-    public void updateDrawPile() {
60
-
61
-//    public void play() {
62
-//        for (int i = 0; i }
63
-
64
-//    int setsCount;
65
-
66
-
67
-        //while (drawPile > 0) {
68
-        //public void questionPlayer(String cardRank, Player player) {
69
-        //start w/ player
70
-        //for (deck.size aka (52 cards - numOfCards per player))
71
-        //askPlayerQuestion(); Prompt w/ question of who to ask [console output?]
72
-        //take userInput [console input?]
73
-        //askPlayerCard(); Prompt w/question of what card (rank) to look for [console output?]
74
-        //take userInput[console input?]
75
-        //for cardHand(chosen player)
76
-        //evalCards(userInput): If userInput.equals(card[i].cardGetValue)
77
-        //swap();
78
-        //repeat until userInput != cardGetValue
79
-        //else
80
-        //goFish(); draw a card from Deck - (deck - 1)
81
-        //move to next player;
82
-        //checkSets: run through each cardHand and looks for 4 of a kind;
83
-        //if found, setsCount++;
84
-
85
-
86
-//    public void evalCards() {
87
-//        //for cards in dealerHand:
88
-////        swap cards or go fish
89
-//    }
90
-//
91
-//    public void goFish() {
92
-//        //pull from top of deck
93
-//    }
94
-//
95
-//    public void checkSets() {
96
-//        // check if 4 in dealerHand have same value
97
-//    }
71
+    public void promptContinue() {
72
+    }                                     //WHAT??
73
+
74
+
75
+    public void playGoFish() {
76
+            askForOpponent();
77
+            searchCard();
78
+            checkCards();
79
+            checkSets();
80
+    }
81
+
82
+    public String askForOpponent() {
83
+        String opponent = Console.getStringInput("Which player would you like to question?");
84
+        return opponent;
85
+    }
86
+
87
+    public Integer searchCard() {
88
+        Integer wantedCard = Console.getIntegerInput("Which card would you like to request?");
89
+        return wantedCard;
90
+    }
91
+
92
+    public void checkCards() {
93
+        String opponent = askForOpponent();
94
+        GoFishPlayer fishie = new GoFishPlayer();
95
+        for (int i = 0; i < goFishPlayers.size(); i++) {
96
+            if (opponent.equals(goFishPlayers.get(i).getName())) {
97
+                Console.println(fishie.getName() + " has " + fishie.getHand().display());  //hopefully this prints out
98
+                for (int j = 0; j < goFishPlayers.get(i).getHand().size(); j++) {
99
+                    while (searchCard().equals(goFishPlayers.get(i).getHand().get(j).getCardValue())) {
100
+                        Console.println("Nice job!");
101
+                        fishie.getHand().add(goFishPlayers.get(i).getHand().get(j));
102
+                        goFishPlayers.get(i).getHand().remove(j);
103
+                        askForOpponent();                                   //need this?
104
+                        searchCard();                                       //need this?
105
+                    }
106
+                    fish();
107
+                }
108
+            }
109
+        }
110
+    }
111
+
112
+
113
+    public void fish() {
114
+        GoFishPlayer player = new GoFishPlayer();
115
+        player.getHand().add(drawPile.removeFirst());
116
+        Console.println("Lame. Go Fish loser \"\\uD83D\\uDC1F\"");
117
+    }
118
+
119
+
120
+    public void checkSets() {                                               // help. lost. trying to set aside the sets
121
+//        GoFishPlayer player = new GoFishPlayer();
122
+        for (int i = 0; i < goFishPlayers.size(); i++) {
123
+            GoFishPlayer currentPlayer = goFishPlayers.get(i);
124
+            for (int j = 0; j < currentPlayer.getHand().size(); j++) {
125
+                int set = 0;
126
+                for (int k = 1; k < currentPlayer.getHand().size(); k++) {
127
+                    if (currentPlayer.getHand().get(j).getCardValue() == currentPlayer.getHand().get(k).getCardValue()) {
128
+                        set++;
129
+                    }
130
+                }
131
+                if (set>=4) {
132
+                    int setCount = currentPlayer.getSetCount();
133
+                    int newSetCount = setCount += 1;
134
+                    currentPlayer.setSetCount(newSetCount);
135
+                }
136
+//                    setCount.put();
137
+//                }
138
+//                goFishPlayers.get(i).getHand();
139
+//                if (setCount.containsKey(goFishPlayers.get(i).getHand().get().getCardValue())))
140
+            }
141
+            {
142
+
143
+            }
144
+        }
145
+
98
 
146
 
99
     }
147
     }
100
-}
148
+}

+ 29
- 25
src/main/java/io/zipcoder/casino/dicegames/Craps.java Просмотреть файл

1
 package io.zipcoder.casino.dicegames;
1
 package io.zipcoder.casino.dicegames;
2
 
2
 
3
-import io.zipcoder.casino.player.BlackJackPlayer;
4
 import io.zipcoder.casino.utilities.Console;
3
 import io.zipcoder.casino.utilities.Console;
5
 import io.zipcoder.casino.utilities.interfaces.Gamble;
4
 import io.zipcoder.casino.utilities.interfaces.Gamble;
6
 import io.zipcoder.casino.player.CrapsPlayer;
5
 import io.zipcoder.casino.player.CrapsPlayer;
18
     public Craps() {
17
     public Craps() {
19
         announceGameChoice();
18
         announceGameChoice();
20
         readyPlayers();
19
         readyPlayers();
20
+        //promptBets();
21
         runGame();
21
         runGame();
22
     }
22
     }
23
     //for test purposes
23
     //for test purposes
40
         }
40
         }
41
     }
41
     }
42
 
42
 
43
-    public void placeBet() {
44
-        this.bet = console.integerInputSameLine("Enter your bet: ");
45
-    }
46
-
47
-    @Override
48
     public void placeBet(Player player) {
43
     public void placeBet(Player player) {
49
-        BlackJackPlayer blackJackPlayer = (BlackJackPlayer) player;
50
-        long bet = Console.getLongInput("Please enter your bet.");
51
-        blackJackPlayer.setBet(bet);
44
+        bet = console.integerInputSameLine("Enter your bet: ");
52
     }
45
     }
53
 
46
 
54
     public void evaluateBet(Player player, long payout) {
47
     public void evaluateBet(Player player, long payout) {
56
     }
49
     }
57
 
50
 
58
     public void play(CrapsPlayer currentPlayer) {
51
     public void play(CrapsPlayer currentPlayer) {
59
-        placeBet();
52
+        placeBet(currentPlayer);
53
+        int sum = rollDie(2);
60
 
54
 
61
         promptEnterKey("roll dice");
55
         promptEnterKey("roll dice");
56
+        printRollSum(sum);
62
 
57
 
63
-        int sum = rollDie(2);
64
-
65
-        console.println("Your roll sum equals: " + sum);
58
+        simulateCraps(currentPlayer, sum);
59
+    }
66
 
60
 
61
+    private void simulateCraps(CrapsPlayer currentPlayer, int sum) {
67
         if (sum == 7 || sum == 11) {
62
         if (sum == 7 || sum == 11) {
68
             evalWin(currentPlayer.getP());
63
             evalWin(currentPlayer.getP());
69
         } else if (sum == 2 || sum == 3 || sum == 12) {
64
         } else if (sum == 2 || sum == 3 || sum == 12) {
70
             evalLoss(currentPlayer.getP());
65
             evalLoss(currentPlayer.getP());
71
         } else {
66
         } else {
72
-            int point = sum;
73
-            do {
74
-                printRollAgain(point);
75
-                sum = rollDie(2);
76
-                evalReRoll(currentPlayer, sum , point);
77
-            } while (sum != point && sum != 7);
67
+            rollForPoint(currentPlayer, sum);
78
         }
68
         }
79
     }
69
     }
80
 
70
 
71
+    private void rollForPoint(CrapsPlayer currentPlayer, int sum) {
72
+        int point = sum;
73
+        do {
74
+            printRollAgain(point);
75
+            sum = rollDie(2);
76
+            evalReRoll(currentPlayer, sum , point);
77
+        } while (sum != point && sum != 7);
78
+    }
79
+
81
     public void print(){
80
     public void print(){
82
         for(int i = 0; i < crapsPlayers.size(); i++){
81
         for(int i = 0; i < crapsPlayers.size(); i++){
83
             System.out.println(crapsPlayers.get(i).getP().getChipBalance());
82
             System.out.println(crapsPlayers.get(i).getP().getChipBalance());
85
     }
84
     }
86
 
85
 
87
     public void printRollAgain(int point){
86
     public void printRollAgain(int point){
88
-        console.println("\n--------------------");
89
-        console.println("Point to roll for: " + point);
90
-        console.println("--------------------");
87
+        console.println("\n=====================" +
88
+                "\nPoint to roll for: " + point + "\n=====================");
91
         promptEnterKey("roll again");
89
         promptEnterKey("roll again");
92
     }
90
     }
93
 
91
 
94
     public void evalReRoll(CrapsPlayer currentPlayer, int sum, int point){
92
     public void evalReRoll(CrapsPlayer currentPlayer, int sum, int point){
95
-        console.println("You rolled a " + sum);
93
+        printRollSum(sum);
96
         if (sum == 7) {
94
         if (sum == 7) {
97
             evalLoss(currentPlayer.getP());
95
             evalLoss(currentPlayer.getP());
98
         } else if (sum == point) {
96
         } else if (sum == point) {
100
         }
98
         }
101
     }
99
     }
102
 
100
 
101
+    private void printRollSum(int sum) {
102
+        console.println("------------------------\n" +
103
+                "Your roll sum equals: " + sum + " \n------------------------");
104
+    }
105
+
103
     public void evalLoss(Player player){
106
     public void evalLoss(Player player){
104
         console.println("\n*********\nYOU LOSE!\n*********\n");
107
         console.println("\n*********\nYOU LOSE!\n*********\n");
105
         evaluateBet(player, -bet);
108
         evaluateBet(player, -bet);
116
     }
119
     }
117
 
120
 
118
     public void promptEnterKey(String str){
121
     public void promptEnterKey(String str){
119
-        String input = console.getStringInput("\nPress \"ENTER\" to " + str);
122
+        String input = console.getStringInput("\n>> " +
123
+                "Press \"ENTER\" to " + str);
120
     }
124
     }
121
 
125
 
122
     @Override
126
     @Override
123
-    public void promptContinue(){};
127
+    public void promptContinue(){}
124
 }
128
 }

+ 5
- 0
src/main/java/io/zipcoder/casino/player/BlackJackPlayer.java Просмотреть файл

6
     private CardHand hand;
6
     private CardHand hand;
7
     Player blackJackPlayer;
7
     Player blackJackPlayer;
8
     private long bet;
8
     private long bet;
9
+    boolean playerBust = false;
10
+
11
+    public boolean isPlayerBust() {
12
+        return playerBust;
13
+    }
9
 
14
 
10
     public long getBet() {
15
     public long getBet() {
11
         return bet;
16
         return bet;

+ 1
- 0
src/main/java/io/zipcoder/casino/player/CrapsPlayer.java Просмотреть файл

20
     public long getBet() {
20
     public long getBet() {
21
         return bet;
21
         return bet;
22
     }
22
     }
23
+    public void setBet(long bet) { this.bet = bet;}
23
 }
24
 }

+ 14
- 0
src/main/java/io/zipcoder/casino/player/GoFishPlayer.java Просмотреть файл

4
 
4
 
5
 public class GoFishPlayer extends Player{
5
 public class GoFishPlayer extends Player{
6
     private CardHand hand;
6
     private CardHand hand;
7
+    int setCount = 0;
8
+
9
+    public int getSetCount() {
10
+        return setCount;
11
+    }
12
+
13
+    public void setSetCount(int setCount) {
14
+        this.setCount = setCount;
15
+    }
7
 
16
 
8
     Player goFishPlayer;
17
     Player goFishPlayer;
9
 
18
 
10
     public GoFishPlayer(Player player) {
19
     public GoFishPlayer(Player player) {
11
         this.goFishPlayer = player;
20
         this.goFishPlayer = player;
21
+        this.hand = new CardHand();
22
+    }
23
+
24
+    public GoFishPlayer() {
25
+
12
     }
26
     }
13
 
27
 
14
     public Player getP() {
28
     public Player getP() {

+ 93
- 9
src/main/java/io/zipcoder/casino/utilities/Console.java Просмотреть файл

1
 package io.zipcoder.casino.utilities;
1
 package io.zipcoder.casino.utilities;
2
 
2
 
3
-import io.zipcoder.casino.Casino;
4
-
5
-import java.awt.peer.SystemTrayPeer;
6
 import java.util.Scanner;
3
 import java.util.Scanner;
7
 
4
 
8
 public class Console {
5
 public class Console {
104
 
101
 
105
     public static void printWcarrot(String output){
102
     public static void printWcarrot(String output){
106
         System.out.println(output);
103
         System.out.println(output);
107
-        System.out.print(">");
104
+        System.out.print("> ");
108
     }
105
     }
109
 
106
 
110
 
107
 
114
         String userInput = scanner.nextLine();
111
         String userInput = scanner.nextLine();
115
         return userInput;
112
         return userInput;
116
       }
113
       }
117
-     public Integer getIntegerInput(String prompt){
114
+     public static Integer getIntegerInput(String prompt){
118
          Scanner scanner = new Scanner(System.in);
115
          Scanner scanner = new Scanner(System.in);
119
          println(prompt);
116
          println(prompt);
120
          int userInput = scanner.nextInt();
117
          int userInput = scanner.nextInt();
140
     }
137
     }
141
 
138
 
142
     public Integer getGameChoice() {
139
     public Integer getGameChoice() {
143
-        println("GAME LIST\n");
140
+        println("\n================");
141
+        println("GAME LIST");
142
+        println("----------------");
144
         println("1. CRAPS\n");
143
         println("1. CRAPS\n");
145
         println("2. BLACK JACK\n");
144
         println("2. BLACK JACK\n");
146
-        println("3. GO FISH\n");
147
-        println("CHOOSE TABLE\n");
148
-        return getIntegerInput("");
145
+        println("3. GO FISH");
146
+        println("================");
147
+        return getIntegerInput("\nCHOOSE TABLE");
149
     }
148
     }
150
 
149
 
150
+    public void kickedOut() {
151
+
152
+        System.out.print("                `!(z$$#####$%+!`                                                   `!!(\"t\"``.\n" +
153
+                "             -*$$j\"+!!(!+*\"J$###j                                                  !\"\"!!.*\"\"#\"!.\n" +
154
+                "           !3\"! !!I$3I\"!!!'   .!!$.                                             '\"(!' .$I(%*!*!#!\n" +
155
+                "         !%!.!$#%(!              '3(             '                            `J\"         `''3\"!I\"\n" +
156
+                "        (+.\"#3!'!(\"**!+!!!         !%.           $*                          .#!    !`!!!       .j#.\n" +
157
+                "       .!!#\".!!!'                   `$'          !#    !                     ut  '!*!*!(\"*!    !#!`\"`\n" +
158
+                "         $\"    .!!!(\"!!!`      '%##\"..$     .!    #.   $                     #(  !!!!!\"!!'`    \"!`..%\n" +
159
+                "       `$(   !!\"!\"$&\"*\"!       3` !##!%      !\"   !\"   #                     #( $! !!+  `        ## %\n" +
160
+                "       \"#'    !!*\"3%$#%!         .!'!'$       \"\"   %.  #   ` !'              +$ 3! !(`           !! $..\n" +
161
+                "       %#'  '(!!!!($##$.         !#% `$'       !+  !(  z  !\".3##$(!          `$! !!.                J!!\"!\n" +
162
+                "       !#\".\"!!!!!!.!!!`           !. .'!!!3.    \"!  %  * .3`  '%####j!!!!!!'` `$! '!(-      !!!`   .#(*!`\n" +
163
+                "        %##`\"' -!!                  \"3!!!\"j.`(`  \"! .         `'\"#############$j#*        .$u!!!!!!j'\n" +
164
+                "         \"#.! .\"!!            '!!    !$'.    !u-  !.      `!I#####################$'      !'\"!!'-!3\"\n" +
165
+                "          \"$'  `.`!        !\"\"\"\"!!!!!!\"       `\"!       `\"##########################3!           \"\"`\n" +
166
+                "           .\"$3\"\"I!       \"!\"\"(! !`!.+!.        '!.    `###############################\"!!.  `!(z!\n" +
167
+                "             .%&.        .! +!!-.(!\"!' !(         \"!   \"####################################%!!.\n" +
168
+                "               '3j!          `'!!`      # !3\"!.        I######################$#$$$%%#########$3!.\n" +
169
+                "                !%!!!!`               .j( z .!$\"       !###################j\"!!-     '\"############\"!!   .+!\n" +
170
+                "      '!\"3$#######%+'.!\"u\"!!'.` ..!!\"\"\"'.!+\"`  !#!      (########################3(.   `!$#############%\"%+(!!!!\n" +
171
+                "   .*$###############$+'\"#J!!!!!!!!.   !(`! !!! .$!      '3#########################$(`   .!&#########!'(. !!!!!\n" +
172
+                " .j######################\"$!!!!!!!!(*'`\"  \"!!``!..#(u!     `(3#########################\"`     '!&###$!!!  \"\"\"\"\"\"\n" +
173
+                "'###########$##############( %#######!'!`!!`    !!.. %!        -!\"$######################!        .! \"\"! !!!!!!.\n" +
174
+                "$########$'  $##############(!#######!!%!        3!!\"\"`(`          '\"#####################t            !$3*!!!'\n" +
175
+                "#########'   .#######################$!          !!    !\"       !!   '$####################\"`!\"j#.      .\"%(\n" +
176
+                "!#$!!'!!+\".   .\"##############    '$!           !(     '$ ' ``'! '+!.  (###################$('!\"!\n" +
177
+                " !$!!!.   !\"!   !$############$.`((           '\"!       # !'.3 !I. -\"I. !####%!!!!%#####$\"!!!!.\n" +
178
+                " !#        `%!   `\"#########$\"!'(`          -\"!  `I    `# .( !( `3!  .j% !!$.!\"!.  `$#\"!!!!\n" +
179
+                " .#!      .#$`  !J#######3!- *.!          !(!    !!    !%  t  \"! `\"\"       '$%!     `\"!\"!\n" +
180
+                "   !*((+\"\"!\". !$######$!    !''        !t\"!      %.    \"!  !!  J'  !%!                '!\n" +
181
+                "            !#####%(!'$`            !j$*.       !*    '$    3  `\".  `\"!\n" +
182
+                "           !\"\"!!!`    !#!`      '!\"J!!!'       !$    `z-    I   `u.   !z'\n" +
183
+                "                       .\"##$$$#%('     \"      !$`    ('     !    `$.   `$!\n" +
184
+                "                             !#`!      !!    !%`                  !#\n" +
185
+                "                           .\"$' '*`    !!   \"*\n" +
186
+                "                         '%%3`         %`  ``\n" +
187
+                "                        .#'!!!!!.    `*!\n" +
188
+                "                          !'!$(``'!\"(!\n" +
189
+                "                             `!$%(!'(u`\n" +
190
+                "                                '!!\"$$!\n");
191
+        /*
192
+
193
+                `!(z$$#####$%+!`                                                   `!!("t"``.
194
+             -*$$j"+!!(!+*"J$###j                                                  !""!!.*""#"!.
195
+           !3"! !!I$3I"!!!'   .!!$.                                             '"(!' .$I(%*!*!#!
196
+         !%!.!$#%(!              '3(             '                            `J"         `''3"!I"
197
+        (+."#3!'!("**!+!!!         !%.           $*                          .#!    !`!!!       .j#.
198
+       .!!#".!!!'                   `$'          !#    !                     ut  '!*!*!("*!    !#!`"`
199
+         $"    .!!!("!!!`      '%##"..$     .!    #.   $                     #(  !!!!!"!!'`    "!`..%
200
+       `$(   !!"!"$&"*"!       3` !##!%      !"   !"   #                     #( $! !!+  `        ## %
201
+       "#'    !!*"3%$#%!         .!'!'$       ""   %.  #   ` !'              +$ 3! !(`           !! $..
202
+       %#'  '(!!!!($##$.         !#% `$'       !+  !(  z  !".3##$(!          `$! !!.                J!!"!
203
+       !#"."!!!!!!.!!!`           !. .'!!!3.    "!  %  * .3`  '%####j!!!!!!'` `$! '!(-      !!!`   .#(*!`
204
+        %##`"' -!!                  "3!!!"j.`(`  "! .         `'"#############$j#*        .$u!!!!!!j'
205
+         "#.! ."!!            '!!    !$'.    !u-  !.      `!I#####################$'      !'"!!'-!3"
206
+          "$'  `.`!        !""""!!!!!!"       `"!       `"##########################3!           ""`
207
+           ."$3""I!       "!""(! !`!.+!.        '!.    `###############################"!!.  `!(z!
208
+             .%&.        .! +!!-.(!"!' !(         "!   "####################################%!!.
209
+               '3j!          `'!!`      # !3"!.        I######################$#$$$%%#########$3!.
210
+                !%!!!!`               .j( z .!$"       !###################j"!!-     '"############"!!   .+!
211
+      '!"3$#######%+'.!"u"!!'.` ..!!"""'.!+"`  !#!      (########################3(.   `!$#############%"%+(!!!!
212
+   .*$###############$+'"#J!!!!!!!!.   !(`! !!! .$!      '3#########################$(`   .!&#########!'(. !!!!!
213
+ .j######################"$!!!!!!!!(*'`"  "!!``!..#(u!     `(3#########################"`     '!&###$!!!  """"""
214
+'###########$##############( %#######!'!`!!`    !!.. %!        -!"$######################!        .! ""! !!!!!!.
215
+$########$'  $##############(!#######!!%!        3!!""`(`          '"#####################t            !$3*!!!'
216
+#########'   .#######################$!          !!    !"       !!   '$####################"`!"j#.      ."%(
217
+!#$!!'!!+".   ."##############    '$!           !(     '$ ' ``'! '+!.  (###################$('!"!
218
+ !$!!!.   !"!   !$############$.`((           '"!       # !'.3 !I. -"I. !####%!!!!%#####$"!!!!.
219
+ !#        `%!   `"#########$"!'(`          -"!  `I    `# .( !( `3!  .j% !!$.!"!.  `$#"!!!!
220
+ .#!      .#$`  !J#######3!- *.!          !(!    !!    !%  t  "! `""       '$%!     `"!"!
221
+   !*((+""!". !$######$!    !''        !t"!      %.    "!  !!  J'  !%!                '!
222
+            !#####%(!'$`            !j$*.       !*    '$    3  `".  `"!
223
+           !""!!!`    !#!`      '!"J!!!'       !$    `z-    I   `u.   !z'
224
+                       ."##$$$#%('     "      !$`    ('     !    `$.   `$!
225
+                             !#`!      !!    !%`                  !#
226
+                           ."$' '*`    !!   "*
227
+                         '%%3`         %`  ``
228
+                        .#'!!!!!.    `*!
229
+                          !'!$(``'!"(!
230
+                             `!$%(!'(u`
231
+                                '!!"$$!
232
+
233
+         */
234
+    }
151
 
235
 
152
 //
236
 //
153
 //    public Integer getPlayersInput(String prompt){
237
 //    public Integer getPlayersInput(String prompt){

+ 1
- 1
src/main/java/io/zipcoder/casino/utilities/abstracts/Game.java Просмотреть файл

17
 
17
 
18
     protected void announceGameChoice() {
18
     protected void announceGameChoice() {
19
         Console console = new Console();
19
         Console console = new Console();
20
-        console.println("Welcome to %s\n", this.getClassName());
20
+        console.println("\nWelcome to %s\n", this.getClassName());
21
     }
21
     }
22
 }
22
 }

+ 0
- 3
src/main/java/io/zipcoder/casino/utilities/containers/CardHand.java Просмотреть файл

8
 
8
 
9
     int numberOfCards = this.size();
9
     int numberOfCards = this.size();
10
 //    private java.util.ArrayList<Card> cardHand;
10
 //    private java.util.ArrayList<Card> cardHand;
11
-//
12
 //    public CardHand(int numberOfCards) {
11
 //    public CardHand(int numberOfCards) {
13
 //        this.numberOfCards = numberOfCards;
12
 //        this.numberOfCards = numberOfCards;
14
 //    }
13
 //    }
20
 //    public void addCard(Card card) {
19
 //    public void addCard(Card card) {
21
 //        add(card);
20
 //        add(card);
22
 //    }
21
 //    }
23
-//
24
 //    public void removeCard(Card card) {
22
 //    public void removeCard(Card card) {
25
 //        remove(card);
23
 //        remove(card);
26
-//
27
 //    }
24
 //    }
28
 
25
 
29
     public String display() {
26
     public String display() {

+ 1
- 0
src/main/java/io/zipcoder/casino/utilities/interfaces/Gamble.java Просмотреть файл

3
 import io.zipcoder.casino.player.Player;
3
 import io.zipcoder.casino.player.Player;
4
 
4
 
5
 public interface Gamble {
5
 public interface Gamble {
6
+
6
     void placeBet(Player player);
7
     void placeBet(Player player);
7
 
8
 
8
     void evaluateBet(Player player, long payout);
9
     void evaluateBet(Player player, long payout);

+ 1
- 0
src/test/java/io/zipcoder/casino/CrapsTest.java Просмотреть файл

17
         CrapsPlayer cplayer2 = new CrapsPlayer(new Player("Joe",100),20);
17
         CrapsPlayer cplayer2 = new CrapsPlayer(new Player("Joe",100),20);
18
         CrapsPlayer cplayer3 = new CrapsPlayer(new Player("Will",100),12);
18
         CrapsPlayer cplayer3 = new CrapsPlayer(new Player("Will",100),12);
19
 
19
 
20
+        //When
20
         playerz.add(cplayer1);
21
         playerz.add(cplayer1);
21
         playerz.add(cplayer2);
22
         playerz.add(cplayer2);
22
         playerz.add(cplayer3);
23
         playerz.add(cplayer3);

+ 123
- 0
src/test/java/io/zipcoder/casino/GoFishTest.java Просмотреть файл

1
+package io.zipcoder.casino;
2
+
3
+import io.zipcoder.casino.player.GoFishPlayer;
4
+import io.zipcoder.casino.player.Player;
5
+import org.junit.Assert;
6
+import org.junit.Test;
7
+
8
+import java.util.ArrayList;
9
+
10
+public class GoFishTest {
11
+
12
+    @Test
13
+    public void goFish() {
14
+        //given
15
+
16
+        //when
17
+
18
+        //then
19
+    }
20
+
21
+    @Test
22
+    public void readyPlayersTest() {
23
+        //given
24
+        ArrayList<GoFishPlayer> fishers = new ArrayList<>();
25
+        GoFishPlayer fisher1 = new GoFishPlayer(new Player("Jae", 0));
26
+        GoFishPlayer fisher2 = new GoFishPlayer(new Player("Thuy", 2));
27
+        GoFishPlayer fisher3 = new GoFishPlayer(new Player("Ned", 0));
28
+        int expectedOutput = 3;
29
+        //when
30
+        fishers.add(fisher1);
31
+        fishers.add(fisher2);
32
+        fishers.add(fisher3);
33
+        //then
34
+        int actualOutput = fishers.size();
35
+        Assert.assertEquals(expectedOutput, actualOutput);
36
+
37
+    }
38
+
39
+    @Test
40
+    public void runGame() {
41
+        //given
42
+
43
+        //when
44
+
45
+        //then
46
+    }
47
+
48
+    @Test
49
+    public void getStartingCardsTest() {
50
+        //given
51
+        ArrayList<GoFishPlayer> fishers = new ArrayList<>();
52
+        GoFishPlayer fisher1 = new GoFishPlayer(new Player("Jae", 0));
53
+        GoFishPlayer fisher2 = new GoFishPlayer(new Player("Thuy", 2));
54
+        GoFishPlayer fisher3 = new GoFishPlayer(new Player("Ned", 0));
55
+        fishers.add(fisher1);
56
+        fishers.add(fisher2);
57
+        fishers.add(fisher3);
58
+        int expectOutput = 7;
59
+        int numberOfPlayers = fishers.size();
60
+
61
+        //when
62
+
63
+
64
+        //then
65
+        int actualOutput = fisher1.getHand().size();
66
+        Assert.assertEquals(expectOutput, actualOutput);
67
+
68
+    }
69
+
70
+    @Test
71
+    public void dealCards() {
72
+        //given
73
+
74
+        //when
75
+
76
+        //then
77
+    }
78
+
79
+    @Test
80
+    public void promptContinue() {
81
+        //given
82
+
83
+        //when
84
+
85
+        //then
86
+    }
87
+
88
+    @Test
89
+    public void playGoFish() {
90
+        //given
91
+
92
+        //when
93
+
94
+        //then
95
+    }
96
+
97
+    @Test
98
+    public void askForOpponent() {
99
+        //given
100
+
101
+        //when
102
+
103
+        //then
104
+    }
105
+
106
+    @Test
107
+    public void searchCard() {
108
+        //given
109
+
110
+        //when
111
+
112
+        //then
113
+    }
114
+
115
+    @Test
116
+    public void checkCards() {
117
+        //given
118
+
119
+        //when
120
+
121
+        //then
122
+    }
123
+}