Nick Satinover 6 years ago
parent
commit
c055f5ca80

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

@@ -8,8 +8,6 @@ import java.util.HashMap;
8 8
 public abstract class CardGame {
9 9
 
10 10
     private int tablePot;
11
-    private int minBet;
12
-    private int maxBet;
13 11
     private int handSize;
14 12
     private int ante;
15 13
     private CardPlayer playersTurn;
@@ -23,16 +21,6 @@ public abstract class CardGame {
23 21
         this.ante = ante;
24 22
     }
25 23
 
26
-    //use hand size to determine dealing
27
-    // public abstract void deal();
28
-    // public abstract void deal(ArrayList<CardPlayer> players); // NEEDED FOR STUD
29
-
30
-    public void shuffle(){
31
-
32
-        //shuffle the card stack
33
-
34
-    }
35
-
36 24
     public Deck getDeck() {
37 25
         return deck;
38 26
     }
@@ -48,7 +36,6 @@ public abstract class CardGame {
48 36
         }
49 37
     }
50 38
 
51
-
52 39
     public int getAnte(){
53 40
         return ante;
54 41
     }
@@ -85,7 +72,7 @@ public abstract class CardGame {
85 72
         addPlayers(new NPC("Opponant", getAnte()));
86 73
     }
87 74
 
88
-    public void chooseStatingPlayer(){
75
+    public void chooseStartingPlayer(){
89 76
         //loop through the players
90 77
         for(int i = 0; i < getPlayers().size(); i ++){
91 78
             //if one is not an NPC

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

@@ -17,12 +17,10 @@ public class Stud extends CardGame implements Game {
17 17
         Printer.printMessage(player.getName() + " shows a " + card.getName());         //PRINT card name to CONSOLE
18 18
     }
19 19
 
20
-
21 20
     public boolean getIsDealt(){
22 21
         return isDealt;
23 22
     }
24 23
 
25
-
26 24
     /**
27 25
      * Determine what player wins by looping through player array and then
28 26
      * passing each hand to the 'handValue' method
@@ -143,10 +141,10 @@ public class Stud extends CardGame implements Game {
143 141
     }
144 142
 
145 143
     public void startGame() {
146
-        setHandSize(3);             //SET Hand Size for game(3)
147
-        payAnte(this.getPlayers());                  //PAY ante (all players)
148
-        deal(this.getPlayers());                     //DEALS cards/ hands to each player
149
-        startRound();               //METHOD called
144
+        setHandSize(3);                 //SET Hand Size for game(3)
145
+        payAnte(this.getPlayers());     //PAY ante (all players)
146
+        deal(this.getPlayers());        //DEALS cards/ hands to each player
147
+        startRound();                   //METHOD called
150 148
 
151 149
     }
152 150
 
@@ -179,9 +177,9 @@ public class Stud extends CardGame implements Game {
179 177
      * Deal each player(and dealer) 3 face down cards in turn
180 178
      */
181 179
     public void deal(ArrayList<CardPlayer> players) {
182
-        for(int i = 0; i < getHandSize(); i ++){                        //OUTER loop - run 3 times as there are 3 cards per hand
183
-            for (int j = 0; j < players.size(); j++) {             //INNER loop through each player
184
-                players.get(j).getHand().add(getDeck().pullCard());                                 //ADD card to player hand
180
+        for(int i = 0; i < getHandSize(); i ++){
181
+            for (int j = 0; j < players.size(); j++) {
182
+                players.get(j).getHand().add(getDeck().pullCard());
185 183
             }
186 184
         }
187 185
         isDealt = true;

+ 1
- 6
src/main/java/io/zipcoder/casino/War.java View File

@@ -1,11 +1,6 @@
1 1
 package io.zipcoder.casino;
2 2
 
3 3
 import java.util.*;
4
-import java.util.concurrent.Executors;
5
-import java.util.concurrent.ScheduledExecutorService;
6
-import java.util.concurrent.TimeUnit;
7
-import java.util.regex.Pattern;
8
-import java.util.concurrent.TimeUnit;
9 4
 
10 5
 public class War extends CardGame implements Gamble, Game {
11 6
 
@@ -116,7 +111,7 @@ public class War extends CardGame implements Gamble, Game {
116 111
 
117 112
     public void startGame(){
118 113
         Printer.printMessage("Welcome to War!");
119
-        super.chooseStatingPlayer();
114
+        super.chooseStartingPlayer();
120 115
         payAnte();
121 116
         deal();
122 117
         startRound();

+ 0
- 11
src/main/java/io/zipcoder/casino/test.java View File

@@ -1,11 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-public class test {
4
-    public static void main(String[] args){
5
-        Player player = new Player("NickTest", 100);
6
-        Game stud = new Stud(10);
7
-        ((Stud) stud).addPlayers(player);
8
-        ((Stud) stud).addNpc();
9
-        stud.startGame();
10
-    }
11
-}

+ 1
- 0
src/test/java/io/zipcoder/casino/CardTest.java View File

@@ -17,4 +17,5 @@ public class CardTest {
17 17
         System.out.println(card.getName());
18 18
         System.out.println(card1.getName());
19 19
     }
20
+
20 21
 }

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

@@ -20,7 +20,7 @@ public class WarTest {
20 20
         War war = new War(10);
21 21
         Player player = new Player("Jon", 100);
22 22
         war.addPlayers(player);
23
-        war.chooseStatingPlayer();
23
+        war.chooseStartingPlayer();
24 24
         war.deal();
25 25
         war.getPlayers().get(0).setDiscard(deck);
26 26
 
@@ -34,7 +34,7 @@ public class WarTest {
34 34
         War war = new War(10);
35 35
         Player player = new Player("Jon", 100);
36 36
         war.addPlayers(player);
37
-        war.chooseStatingPlayer();
37
+        war.chooseStartingPlayer();
38 38
         war.playCard(false);
39 39
 
40 40
         Assert.assertEquals(war.getLoser(), player);