|
@@ -1,77 +1,77 @@
|
1
|
|
-package io.zipcoder.casino;
|
2
|
|
-
|
3
|
|
-public class BlackJack extends CardGames {
|
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
|
|
-
|
16
|
|
- public BlackJack(Player player) {
|
17
|
|
-
|
18
|
|
- }
|
19
|
|
-
|
20
|
|
-
|
21
|
|
-
|
22
|
|
-while(playingBJ == true){
|
23
|
|
- Console.output("Welcome to BlackJack " + player.name + ". I am your dealer Vince and I am here to take your money!");
|
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
|
|
- deck.deal();
|
31
|
|
- } else if (playerHand == 21) {
|
32
|
|
- Console.output("You have BlackJack! You win!");
|
33
|
|
- winBet((currentBet * 3) / 2);
|
34
|
|
- currentBet = 0;
|
35
|
|
- deck.deal();
|
36
|
|
-
|
37
|
|
- }
|
38
|
|
- while (playerHand < 21) {
|
39
|
|
- String action = Console.askForInput("Dealer is showing: " + "You have " + playerHand + ". Please enter 'hit' or 'stay'.");
|
40
|
|
- if (action.equals("hit")) {
|
41
|
|
- drawCard();
|
42
|
|
- cardValue += playerHand;
|
43
|
|
- if (playerHand > 21) {
|
44
|
|
- Console.output("You have " + playerHand + " and bust, you suck!");
|
45
|
|
- loseBet(currentBet);
|
46
|
|
- currentBet = 0;
|
47
|
|
- }
|
48
|
|
- } else if (action.equals("stay")) {
|
49
|
|
- break;
|
50
|
|
- }
|
51
|
|
- }
|
52
|
|
- while (dealerHand < 17 && dealerHand < 21) {
|
53
|
|
- Console.output("Dealer has " + dealerHand + " and hits.");
|
54
|
|
- drawcard();
|
55
|
|
- cardValue += dealerHand;
|
56
|
|
- if (dealerHand > 21) {
|
57
|
|
- Console.output("Dealer has " + dealerHand + " and busts, you win!");
|
58
|
|
- winBet(currentBet);
|
59
|
|
- currentBet = 0;
|
60
|
|
- } else if (dealerHand >= 17 && dealerHand < 21) {
|
61
|
|
- Console.output("Dealer has " + dealerHand + " and stands.");
|
62
|
|
- }
|
63
|
|
- }
|
64
|
|
-
|
65
|
|
-
|
66
|
|
-
|
67
|
|
- }
|
68
|
|
-
|
69
|
|
-}
|
70
|
|
-
|
71
|
|
-
|
72
|
|
-
|
73
|
|
-
|
74
|
|
-
|
75
|
|
-
|
76
|
|
-
|
77
|
|
-
|
|
1
|
+//package io.zipcoder.casino;
|
|
2
|
+//
|
|
3
|
+//public class BlackJack extends CardGames {
|
|
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
|
+//
|
|
16
|
+// public BlackJack(Player player) {
|
|
17
|
+//
|
|
18
|
+// }
|
|
19
|
+//
|
|
20
|
+//
|
|
21
|
+//
|
|
22
|
+//while(playingBJ == true){
|
|
23
|
+// Console.output("Welcome to BlackJack " + player.name + ". I am your dealer Vince and I am here to take your money!");
|
|
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
|
+// deck.deal();
|
|
31
|
+// } else if (playerHand == 21) {
|
|
32
|
+// Console.output("You have BlackJack! You win!");
|
|
33
|
+// winBet((currentBet * 3) / 2);
|
|
34
|
+// currentBet = 0;
|
|
35
|
+// deck.deal();
|
|
36
|
+//
|
|
37
|
+// }
|
|
38
|
+// while (playerHand < 21) {
|
|
39
|
+// String action = Console.askForInput("Dealer is showing: " + "You have " + playerHand + ". Please enter 'hit' or 'stay'.");
|
|
40
|
+// if (action.equals("hit")) {
|
|
41
|
+// drawCard();
|
|
42
|
+// cardValue += playerHand;
|
|
43
|
+// if (playerHand > 21) {
|
|
44
|
+// Console.output("You have " + playerHand + " and bust, you suck!");
|
|
45
|
+// loseBet(currentBet);
|
|
46
|
+// currentBet = 0;
|
|
47
|
+// }
|
|
48
|
+// } else if (action.equals("stay")) {
|
|
49
|
+// break;
|
|
50
|
+// }
|
|
51
|
+// }
|
|
52
|
+// while (dealerHand < 17 && dealerHand < 21) {
|
|
53
|
+// Console.output("Dealer has " + dealerHand + " and hits.");
|
|
54
|
+// drawcard();
|
|
55
|
+// cardValue += dealerHand;
|
|
56
|
+// if (dealerHand > 21) {
|
|
57
|
+// Console.output("Dealer has " + dealerHand + " and busts, you win!");
|
|
58
|
+// winBet(currentBet);
|
|
59
|
+// currentBet = 0;
|
|
60
|
+// } else if (dealerHand >= 17 && dealerHand < 21) {
|
|
61
|
+// Console.output("Dealer has " + dealerHand + " and stands.");
|
|
62
|
+// }
|
|
63
|
+// }
|
|
64
|
+//
|
|
65
|
+//
|
|
66
|
+//
|
|
67
|
+// }
|
|
68
|
+//
|
|
69
|
+//}
|
|
70
|
+//
|
|
71
|
+//
|
|
72
|
+//
|
|
73
|
+//
|
|
74
|
+//
|
|
75
|
+//
|
|
76
|
+//
|
|
77
|
+//
|