|
@@ -1,29 +1,52 @@
|
1
|
1
|
package io.zipcoder.casino;
|
2
|
2
|
|
3
|
|
-public class BlackJack {
|
4
|
|
-int playerHand;
|
5
|
|
-int dealerHand;
|
6
|
|
-int currentBet;
|
7
|
|
-boolean playingBJ = false;
|
8
|
|
-CardDeck deck = new CardDeck();
|
9
|
|
-
|
10
|
|
-public void start(){
|
11
|
|
- playingBj = true;
|
|
3
|
+public class BlackJack extends CardGames implements Gamble, Game{
|
|
4
|
+ int playerHand;
|
|
5
|
+ int dealerHand;
|
|
6
|
+ int currentBet;
|
|
7
|
+ boolean playingBJ = false;
|
|
8
|
+ CardDeck deck = new CardDeck();
|
|
9
|
+ Player player;
|
|
10
|
+
|
|
11
|
+ public void start() {
|
|
12
|
+ playingBj = true;
|
|
13
|
+ }
|
|
14
|
+
|
|
15
|
+public BlackJack(Player player){
|
|
16
|
+
|
12
|
17
|
}
|
13
|
18
|
|
14
|
19
|
|
15
|
|
-while(playingBJ == true){
|
16
|
|
- deck.deal();
|
17
|
|
- Cons
|
18
|
20
|
|
|
21
|
+while(playingBJ ==true)
|
|
22
|
+
|
|
23
|
+ {
|
|
24
|
+ currentBet = Console.numberFromString(Console.askForInput("How much would you like to bet?"));
|
|
25
|
+ deck.deal();
|
|
26
|
+ if (dealerHand == 21) {
|
|
27
|
+ Console.output("Dealer has BlackJack! You lose!");
|
|
28
|
+ loseBet(currentBet);
|
|
29
|
+ currentBet = 0;
|
|
30
|
+ } else if (playerHand == 21) {
|
|
31
|
+ Console.output("Dealer has BlackJack! You lose!");
|
|
32
|
+ winBet(currentBet);
|
|
33
|
+ currentBet = 0;
|
|
34
|
+ }
|
19
|
35
|
|
20
|
36
|
|
21
|
|
- }
|
22
|
37
|
|
23
|
38
|
|
24
|
39
|
|
25
|
40
|
|
|
41
|
+ String action = Console.askForInput("Do you want to hit or stay?");
|
26
|
42
|
|
|
43
|
+ if (action.equals("hit")) {
|
|
44
|
+
|
|
45
|
+ }
|
|
46
|
+ if (action.equals("stay"))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+ }
|
27
|
50
|
|
28
|
51
|
|
29
|
52
|
}
|