Lauren Green 6 years ago
parent
commit
0262b67df4

BIN
.DS_Store View File


BIN
src/.DS_Store View File


BIN
src/main/.DS_Store View File


BIN
src/main/java/.DS_Store View File


BIN
src/main/java/io/.DS_Store View File


BIN
src/main/java/io/zipcoder/.DS_Store View File


+ 1
- 3
src/main/java/io/zipcoder/casino/CardGame.java View File

19
     private Deck deck = new Deck();
19
     private Deck deck = new Deck();
20
 
20
 
21
 
21
 
22
-    CardGame(int minBet, int maxBet, int ante){
23
-        this.minBet = minBet;
24
-        this.maxBet = maxBet;
22
+    CardGame(int ante){
25
         this.ante = ante;
23
         this.ante = ante;
26
     }
24
     }
27
 
25
 

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

47
             switch (command) {
47
             switch (command) {
48
 
48
 
49
                 case "war":
49
                 case "war":
50
-                    int[] warMinMax = getMinMax();
51
-                    Game war = new War(warMinMax[0], warMinMax[1], 10);
50
+                    Game war = new War(10);
52
                     ((War) war).addPlayers(players.get(0));
51
                     ((War) war).addPlayers(players.get(0));
53
                     ((War) war).addNpc();
52
                     ((War) war).addNpc();
54
                     war.startGame();
53
                     war.startGame();
55
                     break;
54
                     break;
56
 
55
 
57
                 case "stud":
56
                 case "stud":
58
-                    int[] studMinMax = getMinMax();
59
-                    Game stud = new Stud(studMinMax[0], studMinMax[1], 10);
57
+                    Game stud = new Stud( 10);
60
                     ((Stud) stud).addPlayers(players.get(0));
58
                     ((Stud) stud).addPlayers(players.get(0));
61
                     addStudPlayers(stud);
59
                     addStudPlayers(stud);
62
                     stud.startGame();
60
                     stud.startGame();
90
         return -1;
88
         return -1;
91
     }
89
     }
92
 
90
 
93
-    public int[] getMinMax(){
94
-        Printer.getBet("minimum bet");
95
-        int min = 0;
96
-        while(min <= 0){
97
-            min = getIntFromUser();
98
-            if(min < 0){
99
-                Printer.unacceptableMinBet();
100
-            }
101
-        }
102
-
103
-        Printer.getBet("maximum bet");
104
-        int max = 0;
105
-        while(max < min) {
106
-            max = getIntFromUser();
107
-            if(max < min){
108
-                Printer.unacceptableMaxBet(min);
109
-            }
110
-        }
111
-        int[] minMax = {min, max};
112
-        return minMax;
113
-    }
114
-
115
     public String getCommand() {
91
     public String getCommand() {
116
         String command = "";
92
         String command = "";
117
         String input = scanner.next();
93
         String input = scanner.next();
127
         return command;
103
         return command;
128
     }
104
     }
129
 
105
 
130
-    public String continueAskGame(){
131
-
132
-        String command = "";
133
-
134
-        System.out.println("Please choose a game to play!");
135
-        command = getCommand();
136
-
137
-        if(gameLib.indexOf(command) == -1)
138
-        {
139
-            while(gameLib.indexOf(command) == -1)
140
-            {
141
-                Printer.noMatchingGameName(gameLib);
142
-                command = getCommand();
143
-            }
144
-        }
145
-        return command;
146
-    }
147
-
148
     public int getStudPlayers() {
106
     public int getStudPlayers() {
149
         int numOfStudPlayers = 0;
107
         int numOfStudPlayers = 0;
150
 
108
 

+ 13
- 7
src/main/java/io/zipcoder/casino/Stud.java View File

6
     Console console;
6
     Console console;
7
     // private int roundCount = 0;
7
     // private int roundCount = 0;
8
 
8
 
9
-    public Stud(int minBet, int maxBet, int ante) {
10
-        super(minBet, maxBet, ante);
9
+    public Stud(int ante) {
10
+        super(ante);
11
     }
11
     }
12
     
12
     
13
     public void playCard(Player player, Card card) {
13
     public void playCard(Player player, Card card) {
189
      * Plays through rounds that includes flipping cards face up and then betting or folding
189
      * Plays through rounds that includes flipping cards face up and then betting or folding
190
      */
190
      */
191
     public void gameRound1(){
191
     public void gameRound1(){
192
-        for (int j = 0; j < getPlayers().size(); j++) {
193
-            CardPlayer player = super.getPlayers().get(j);                       //GET a player
194
-            playCard(player.getPlayer(), player.getHand().get(0));      //SHOW-PRINT players first CARD
195
-            //roundCount++;
196
-        }
192
+
193
+        playersPlayCard();
194
+
197
         for (int x = 0; x < getPlayers().size(); x++) {                          //Betting round or fold
195
         for (int x = 0; x < getPlayers().size(); x++) {                          //Betting round or fold
198
             CardPlayer player = super.getPlayers().get(x);
196
             CardPlayer player = super.getPlayers().get(x);
199
             int bet;
197
             int bet;
212
         }
210
         }
213
     }
211
     }
214
 
212
 
213
+    public void playersPlayCard(){
214
+        for (int j = 0; j < getPlayers().size(); j++) {
215
+            CardPlayer player = super.getPlayers().get(j);                       //GET a player
216
+            playCard(player.getPlayer(), player.getHand().get(0));      //SHOW-PRINT players first CARD
217
+            //roundCount++;
218
+        }
219
+    }
220
+
215
     public void quit() {}
221
     public void quit() {}
216
 
222
 
217
     /**
223
     /**

+ 12
- 5
src/main/java/io/zipcoder/casino/War.java View File

14
     private Scanner scanner = new Scanner(System.in);
14
     private Scanner scanner = new Scanner(System.in);
15
     private boolean war = false;
15
     private boolean war = false;
16
 
16
 
17
-    War(int minBet, int maxBet, int ante) {
18
-        super(minBet, maxBet, ante);
17
+    War(int ante) {
18
+        super(ante);
19
     }
19
     }
20
 
20
 
21
 
21
 
151
 
151
 
152
     public void startRound() {
152
     public void startRound() {
153
         while(super.getLoser() == null) {
153
         while(super.getLoser() == null) {
154
-            System.out.println("Type play to play the top card from your pile.");
155
-            String input = scanner.next();
156
-            input = input.toLowerCase().trim();
154
+
155
+            String input = getCommand();
156
+
157
             if (input.equals("play")) {
157
             if (input.equals("play")) {
158
                 //each player
158
                 //each player
159
                 for (CardPlayer player : super.getPlayers()) {
159
                 for (CardPlayer player : super.getPlayers()) {
178
 
178
 
179
     }
179
     }
180
 
180
 
181
+    public String getCommand(){
182
+        System.out.println("Type play to play the top card from your pile.");
183
+        String input = scanner.next();
184
+        input = input.toLowerCase().trim();
185
+        return input;
186
+    }
187
+
181
     public void deal() {
188
     public void deal() {
182
         //while there are cards in the deck
189
         //while there are cards in the deck
183
         while(super.getDeck().size() != 0){
190
         while(super.getDeck().size() != 0){

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

1
+package io.zipcoder.casino;
2
+
3
+import org.junit.Test;
4
+
5
+public class WarTest {
6
+
7
+    @Test
8
+    public void warTest01(){
9
+
10
+    }
11
+
12
+}