|
@@ -8,72 +8,75 @@ import java.util.ArrayList;
|
8
|
8
|
|
9
|
9
|
public class Console_BlackJack {
|
10
|
10
|
|
11
|
|
- private static String tie = "\n\n~~~~~~~~~~~~~~~~~~~\n\nTie, no one wins";
|
12
|
|
- private static String win = "\n\n~~~~~~~~~~~~~~~~~~~\n\nYou win!";
|
13
|
|
- private static String lose = "\n\n~~~~~~~~~~~~~~~~~~~\n\nYou lose!";
|
14
|
|
-
|
15
|
|
- public static void printResult(BlackJackPlayer blackJackPlayer, BlackJackPlayer dealer, char result) {
|
16
|
|
- String playerResult = "";
|
17
|
|
- switch (result) {
|
18
|
|
- case 'T':
|
19
|
|
- playerResult = tie;
|
20
|
|
- break;
|
21
|
|
- case 'W':
|
22
|
|
- playerResult = win;
|
23
|
|
- case 'L':
|
24
|
|
- playerResult = lose;
|
25
|
|
- }
|
26
|
|
- System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Hand Value: " + blackJackPlayer.getHandValue() + "\n\nDealer's Hand Value: " + dealer.getHandValue() + playerResult);
|
|
11
|
+ public static void inputError() {
|
|
12
|
+ System.out.println("That's not a valid option, please try again.");
|
|
13
|
+ }
|
|
14
|
+
|
|
15
|
+ public static void finalGoodbye() {
|
|
16
|
+ System.out.println("Thanks for coming to Thunder Theta, good bye!");
|
27
|
17
|
}
|
28
|
18
|
|
|
19
|
+ public static void blackJackWelcome(Player player){
|
|
20
|
+ System.out.println("\nHi " + player.getName() + "! Welcome to BlackJack!\n\nThe minimum bet is $50.");
|
|
21
|
+ }
|
29
|
22
|
|
30
|
23
|
public static String inGameMenu(BlackJack blackJack, BlackJackPlayer blackJackPlayer, BlackJackPlayer dealer) {
|
31
|
24
|
String response = Console.getStringInput("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\nMYSTERY-CARD || " + formatHand(dealer.getDealerHand()) + "\n\nDealer's Hand Value: ??" +
|
32
|
25
|
"\n\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Hand: \n\n" + formatHand(blackJackPlayer.getPlayerHand()) + "\n\nYour Hand Value: " + formatHandValue(blackJack.countPlayerHand(blackJackPlayer)) +
|
33
|
|
- "\n\n~~~~~~~~~~~~~~~~~~~\n\nYOUR TURN" + "\n\n~~~~~~~~~~~~~~~~~~~\n\nWhat do you want to do?\n<< Hit - Stand - Double Down - Split - Quit >>").toUpperCase();
|
|
26
|
+ "\n\n~~~~~~~~~~~~~~~~~~~\n\nYOUR TURN" + "\n\n~~~~~~~~~~~~~~~~~~~\n\nWhat do you want to do?\n\n<< Hit - Stand - Double Down - Split - Quit >>").toUpperCase();
|
34
|
27
|
return response;
|
35
|
28
|
}
|
36
|
29
|
|
37
|
|
- public static void handVSHand(BlackJack blackJack, BlackJackPlayer blackJackPlayer) {
|
|
30
|
+ public static void endGame(BlackJack blackJack, BlackJackPlayer blackJackPlayer, char result) {
|
38
|
31
|
String name = blackJackPlayer.getPlayer().getName();
|
39
|
|
- System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\nMYSTERY-CARD || " + formatHand(blackJack.getDealer().getDealerHand()) + "\n\nDealer's Hand Value: ??");
|
40
|
|
- System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\n" + name + "'s Current Hand: \n\n" + formatHand(blackJackPlayer.getPlayerHand()) + "\n\n" + name + "'s Hand Value: " + formatHandValue(blackJack.countPlayerHand(blackJackPlayer)));
|
|
32
|
+ System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDETERMINING WINNER...");
|
|
33
|
+ System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Hand Value: " + formatHandValue(blackJack.countPlayerHand(blackJack.getDealer())));
|
|
34
|
+ System.out.println("\nYour Hand Value: " + formatHandValue(blackJack.countPlayerHand(blackJackPlayer)));
|
|
35
|
+ winOrLose(blackJackPlayer, result);
|
41
|
36
|
}
|
42
|
37
|
|
43
|
|
- public static void endOfGame(BlackJack blackJack, BlackJackPlayer blackJackPlayer, char result) {
|
44
|
|
- String name = blackJackPlayer.getPlayer().getName();
|
45
|
|
- System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDETERMINING WINNER...");
|
46
|
|
- System.out.println("\nDealer's Hand Value: " + formatHandValue(blackJack.countPlayerHand(blackJack.getDealer())));
|
47
|
|
- System.out.println("\n" + name + "'s Hand Value: " + formatHandValue(blackJack.countPlayerHand(blackJackPlayer)));
|
48
|
|
- switch (result) {
|
49
|
|
- case '+':
|
50
|
|
- System.out.println("\nYou Won: $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
|
51
|
|
- break;
|
52
|
|
- case '-':
|
53
|
|
- System.out.println("\nYou Lost: $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
|
54
|
|
- break;
|
55
|
|
- default:
|
56
|
|
- System.out.println("\nTie Game.\n\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
|
57
|
|
- break;
|
|
38
|
+ public static void winOrLose(BlackJackPlayer blackJackPlayer, char result) {
|
|
39
|
+ switch (result) {
|
|
40
|
+ case '+':
|
|
41
|
+ System.out.println("\nYou Won: $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
|
|
42
|
+ break;
|
|
43
|
+ case '-':
|
|
44
|
+ System.out.println("\nYou Lost: $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
|
|
45
|
+ break;
|
|
46
|
+ default:
|
|
47
|
+ System.out.println("\nTie Game.\n\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
|
|
48
|
+ break;}
|
|
49
|
+ }
|
|
50
|
+
|
|
51
|
+ public static void hitCard(BlackJackPlayer blackJackPlayer, Card card){
|
|
52
|
+ if (blackJackPlayer.getPlayer().getName().equals("Dealer")) {
|
|
53
|
+ System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer Hit: " + card.toString());
|
|
54
|
+ System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDealer's Current Hand: \n\nMYSTERY-CARD || " + formatHand(blackJackPlayer.getDealerHand()) + "\n\nDealer's Hand Value: ??");
|
|
55
|
+ } else {
|
|
56
|
+ System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYou Hit: " + card.toString());
|
|
57
|
+ // System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYour Current Hand: \n\n" + formatHand(blackJackPlayer.getPlayerHand()) + "\n\nYour Hand Value: " + formatHandValue(blackJack.countPlayerHand(blackJackPlayer)));
|
58
|
58
|
}
|
59
|
59
|
}
|
60
|
60
|
|
61
|
|
- public static void winMoney(BlackJack blackJack, BlackJackPlayer blackJackPlayer) {
|
|
61
|
+ public static void standingStill() {
|
|
62
|
+ System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nStanding still!");
|
|
63
|
+ }
|
62
|
64
|
|
63
|
|
- System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDETERMINING WINNER...");
|
64
|
|
- System.out.println("\nYou Won: $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
|
|
65
|
+ public static void dealerTurn() {
|
|
66
|
+ System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDEALER'S TURN");
|
65
|
67
|
}
|
66
|
68
|
|
67
|
|
- public static void loseMoney(BlackJack blackJack, BlackJackPlayer blackJackPlayer) {
|
68
|
|
- handVSHand(blackJack, blackJackPlayer);
|
69
|
|
- System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDETERMINING WINNER...");
|
70
|
|
- System.out.println("\nYou Lost: $" + blackJackPlayer.getBetPot() + "\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
|
|
69
|
+ public static void initiateGame(BlackJackPlayer blackJackPlayer) {
|
|
70
|
+ System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nYOUR BET: " + blackJackPlayer.getBetPot());
|
|
71
|
+ System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nGAME START - DEALING CARDS");
|
71
|
72
|
}
|
72
|
73
|
|
73
|
|
- public static void tieGame(BlackJack blackJack, BlackJackPlayer blackJackPlayer) {
|
74
|
|
- handVSHand(blackJack, blackJackPlayer);
|
75
|
|
- System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nDETERMINING WINNER...");
|
76
|
|
- System.out.println("\nTie Game.\n\nCurrent Wallet: $" + blackJackPlayer.getPlayer().getWallet());
|
|
74
|
+ public static String askPlayAgain() {
|
|
75
|
+ return Console.getStringInput("\n~~~~~~~~~~~~~~~~~~~\n\nWould you like to play again?\n\n<< Yes - No >>").toUpperCase();
|
|
76
|
+ }
|
|
77
|
+
|
|
78
|
+ public static void goodByeMessage() {
|
|
79
|
+ System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nThanks for playing! Now returning to the Casino Lobby.");
|
77
|
80
|
}
|
78
|
81
|
|
79
|
82
|
public static String formatHand(ArrayList<Card> array) {
|