Jason Gibbs 6 gadus atpakaļ
vecāks
revīzija
274df5e1b8

+ 2
- 2
src/main/java/io/zipcoder/casino/BlackJack.java Parādīt failu

@@ -39,7 +39,7 @@ public class BlackJack {
39 39
         int calcValue = 0;
40 40
         switch(rank) {
41 41
             case ACE:
42
-                calcValue = 1;
42
+                calcValue = Console.numberFromString(Console.askForInput("Do you want the ACE to be a 1 or 11"));
43 43
                 break;
44 44
             case TWO:
45 45
                 calcValue = 2;
@@ -80,7 +80,7 @@ public class BlackJack {
80 80
     private int calcHand(ArrayList<Card> hand) {
81 81
         int totalScore = 0;
82 82
         for (int i = 0; i < hand.size(); i++) {
83
-            totalScore = getCardValue(hand.get(i));
83
+            totalScore += getCardValue(hand.get(i));
84 84
         }
85 85
         return totalScore;
86 86
     }

+ 9
- 19
src/main/java/io/zipcoder/casino/CardGame.java Parādīt failu

@@ -11,35 +11,25 @@ public abstract class CardGame implements Game, Gamble {
11 11
     public CardGame(Player player) {
12 12
 
13 13
         this.player = player;
14
-        this.deck = new deck();
14
+        this.deck = new CardDeck();
15 15
 
16 16
     }
17 17
 
18 18
 
19
-    public int drawCard() {
19
+    public abstract Card drawCard();
20 20
 
21
+    public abstract void stand();
21 22
 
22
-    }
23
-
24
-    public void stand() {
25
-
26
-    }
27
-
28
-    void startGame();
23
+    public abstract void startGame();
29 24
 
30
-    void endGame();
25
+    public abstract void endGame();
31 26
 
32
-    void declareWinner();
27
+    public abstract void declareWinner();
33 28
 
34
-    void bet(int currentBet) {
29
+    public abstract void winBet();
35 30
 
36
-    }
37
-    void winBet() {
38
-
39
-    }
40
-    void loseBet(Player player) {
41
-
42
-    }
31
+    public abstract void loseBet(Player player);
32
+}
43 33
 
44 34
 
45 35
 

+ 8
- 6
src/main/java/io/zipcoder/casino/Casino.java Parādīt failu

@@ -3,14 +3,15 @@ package io.zipcoder.casino;
3 3
 
4 4
 public class Casino {
5 5
 
6
-    private Player player;
6
+    private Player player = new Player();
7 7
     private String choice;
8
-    private Console console;
9 8
     //GameFactory gf;
10 9
 
11 10
     public void startCasino() {
12 11
         do {
13 12
             System.out.println("Welcome to the Zip Code Casino!");
13
+            String name = Console.askForInput("What is your name");
14
+            player.setName(name);
14 15
             System.out.println("Which game would you like to play? ");
15 16
             System.out.println("1: BlackJack");
16 17
             System.out.println("2: Baccarat");
@@ -18,10 +19,11 @@ public class Casino {
18 19
             System.out.println(choice);
19 20
 
20 21
             if (choice.equalsIgnoreCase("1")) {
21
-                BlackJack blackjack = new BlackJack();
22
-                blackjack.start();
23
-
24
-            }
22
+                Game blackjack = new BlackJack();
23
+             //   GameFactory.createB ;
24
+            } //else if (choice.equalsIgnoreCase("2")) {
25
+              //  Baccarat baccarat = new Baccarat();
26
+           // }
25 27
         } while (false);
26 28
 
27 29
         }

+ 8
- 9
src/main/java/io/zipcoder/casino/GameFactory.java Parādīt failu

@@ -1,11 +1,10 @@
1 1
 package io.zipcoder.casino;
2 2
 
3
-//public class GameFactory {
4
-//    public static Game getGame( gameName, Player player) {
5
-//        gameName = Consoler.numberFromString(gameName);
6
-//        switch(gameName) {
7
-//            case 1:
8
-//
9
-//        }
10
-//    }
11
-//}
3
+public class GameFactory {
4
+    BlackJack blackJack;
5
+    public static void getGame( gameName, Player player) {
6
+
7
+
8
+        }
9
+    }
10
+}