Selaa lähdekoodia

about to merge with war

Nick Satinover 6 vuotta sitten
vanhempi
commit
ae1192b5a7

+ 4
- 0
src/main/java/io/zipcoder/casino/CardGame.java Näytä tiedosto

@@ -79,4 +79,8 @@ public abstract class CardGame {
79 79
     public int getHandSize() {
80 80
         return handSize;
81 81
     }
82
+
83
+    public void setHandSize(int handSize){
84
+        this.handSize = handSize;
85
+    }
82 86
 }

+ 66
- 19
src/main/java/io/zipcoder/casino/Stud.java Näytä tiedosto

@@ -1,52 +1,99 @@
1 1
 package io.zipcoder.casino;
2 2
 
3
+import java.util.ArrayList;
4
+
3 5
 public class Stud extends CardGame implements Gamble, Game {
6
+    // ArrayList<Card> playerHand = new ArrayList<>(3);
7
+
4 8
     public Stud(int minBet, int maxBet, int ante) {
5 9
         super(minBet, maxBet, ante);
6
-    }
7
-
8
-    public void Deal() {
9 10
 
10 11
     }
11 12
 
12 13
 
13
-    public void determineWinner(){
14
-
14
+    public void playCard(){
15
+        //turn card faceUp
15 16
     }
16 17
 
17
-    public void fold(){
18
-
18
+    public Player determineWinner(){
19
+        return null;
19 20
     }
20 21
 
21
-    /**
22
-     * Below 3 Implemented from Gamble
23
-     * @param betAmount
24
-     */
25 22
     public void Bet(int betAmount) {
26
-
23
+        super.changeTablePot(betAmount);
27 24
     }
28 25
 
29 26
     public int Payout(int payoutAmount) {
27
+        if(super.getWinner() != null){
28
+            super.getWinner().changeBalance(super.getTablePot());
29
+        }
30 30
         return 0;
31 31
     }
32 32
 
33
-    public void Ante(int anteAmount) {
34
-
33
+    public void payAnte() {
34
+        for(int i = 0; i < super.getPlayers().size(); i ++)
35
+        {
36
+            CardPlayer player = super.getPlayers().get(i);
37
+            player.getPlayer().changeBalance(-super.getAnte());
38
+        }
35 39
     }
36 40
 
37
-    /**
38
-     * Below 3 Implemented from Game
39
-     */
40
-
41 41
     public void Quit() {
42
+        //playAgain?
43
+        // Shuffle
42 44
 
43 45
     }
44 46
 
45 47
     public void StartGame() {
46
-
48
+        Deck deck = new Deck();
49
+        // Set Hand Size for game
50
+        setHandSize(3);
51
+        //Player(s) pay ante
52
+        payAnte();
53
+        //Dealer deals 3 cards in turn to each player(and dealer)
54
+        Deal();
47 55
     }
48 56
 
49 57
     public void StartRound() {
50 58
 
59
+        //Each player turns a card1 in hand to face up
60
+        //player(s) bets or folds
61
+            //if bet, players turn card2 face up
62
+        //player(s) bets or folds
63
+            //if bet, players turn card3 face up
64
+        //determinewinner
65
+        //add all table cards to table deck face down
66
+
67
+    }
68
+
69
+    public void
70
+
71
+    /**
72
+     * Deal each player(and dealer) 3 face down cards in turn
73
+     */
74
+    public void Deal() {
75
+        for(int i = 0; i < getHandSize() * getPlayers().size(); i ++)
76
+        {
77
+            //grab the card from the top (last added) to the deck
78
+            Card card = super.getDeck().pullCard();
79
+            //get the player whos hand we are adding the card to
80
+            CardPlayer player = super.getPlayers().get(i);
81
+            //add the card to their hand
82
+            player.getHand().add(card);
83
+        }
51 84
     }
52 85
 }
86
+/*
87
+    public void Deal() {
88
+        for(int i = 0; i < getHandSize() * getPlayers().size(); i ++)
89
+        {
90
+            //grab the card from the top (last added) to the deck
91
+            Card card = deck.pullCard();
92
+            //get the player whos hand we are adding the card to
93
+            CardPlayer player = super.getPlayers().get(i);
94
+            //add the card to their hand
95
+            player.getHand().add(card);
96
+            //remove the card from the deck
97
+            super.getDeck().remove(card);
98
+        }
99
+    }