Browse Source

pseudo code for startround in war

Jonathan Hinds 6 years ago
parent
commit
f393813214

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

46
         return players;
46
         return players;
47
     }
47
     }
48
 
48
 
49
+    public void setDeck(ArrayList<Card> deck) {
50
+        this.deck = deck;
51
+    }
52
+
53
+    public int getAnte(){
54
+        return ante;
55
+    }
49
 }
56
 }

+ 4
- 0
src/main/java/io/zipcoder/casino/CardPlayer.java View File

10
     public ArrayList<Card> getHand(){
10
     public ArrayList<Card> getHand(){
11
         return hand;
11
         return hand;
12
     }
12
     }
13
+
14
+    public Player getPlayer() {
15
+        return player;
16
+    }
13
 }
17
 }

+ 4
- 1
src/main/java/io/zipcoder/casino/Deck.java View File

11
      * Then, they are shuffled
11
      * Then, they are shuffled
12
      */
12
      */
13
     public Deck(){
13
     public Deck(){
14
+        createDeck();
15
+    }
16
+
17
+    public void createDeck(){
14
         this.deck = new ArrayList<>();
18
         this.deck = new ArrayList<>();
15
 
19
 
16
         for (int i = 0; i < 13; i++){
20
         for (int i = 0; i < 13; i++){
21
                 this.deck.add(card);
25
                 this.deck.add(card);
22
             }
26
             }
23
         }
27
         }
24
-
25
         Collections.shuffle(deck);
28
         Collections.shuffle(deck);
26
     }
29
     }
27
 
30
 

+ 0
- 1
src/main/java/io/zipcoder/casino/Gamble.java View File

3
 public interface Gamble {
3
 public interface Gamble {
4
      void Bet(int betAmount);
4
      void Bet(int betAmount);
5
      int Payout(int payoutAmount);
5
      int Payout(int payoutAmount);
6
-     void Ante(int anteAmount);
7
 }
6
 }

+ 19
- 4
src/main/java/io/zipcoder/casino/War.java View File

41
         return 0;
41
         return 0;
42
     }
42
     }
43
 
43
 
44
-    public void Ante(int anteAmount) {
45
-
44
+    public void payAnte() {
45
+        for(int i = 0; i < super.getPlayers().size(); i ++)
46
+        {
47
+            CardPlayer player = super.getPlayers().get(i);
48
+            player.getPlayer().changeBalance(-super.getAnte());
49
+        }
46
     }
50
     }
47
 
51
 
48
     /**
52
     /**
54
     }
58
     }
55
 
59
 
56
     public void StartGame() {
60
     public void StartGame() {
57
-
61
+        Deck deck = new Deck();
62
+        payAnte();
63
+        Deal();
58
     }
64
     }
59
 
65
 
60
     public void StartRound() {
66
     public void StartRound() {
61
-
67
+        //player plays a card faceup
68
+        //remove cards from player hand
69
+        //pc plays a card faceup
70
+        //remove cards from npc hand
71
+        //determinewinner
72
+        //add all table cards to winners discard facedown
73
+
74
+        //when player is out of cards
75
+        //shuffle players discard
76
+        //insert discard into hand facedown
62
     }
77
     }
63
 
78
 
64
     public void Deal() {
79
     public void Deal() {