소스 검색

casino test

Jennifer Chao 6 년 전
부모
커밋
eb6c0f88ec
2개의 변경된 파일123개의 추가작업 그리고 3개의 파일을 삭제
  1. 3
    3
      src/main/java/io/zipcoder/casino/CardGame/BlackJack/BlackJack.java
  2. 120
    0
      src/main/java/io/zipcoder/casino/Casino_test.java

+ 3
- 3
src/main/java/io/zipcoder/casino/CardGame/BlackJack/BlackJack.java 파일 보기

@@ -156,7 +156,7 @@ public class BlackJack extends CardGame implements Gamble {
156 156
         int initialBet;
157 157
         // String input = userInput.toUpperCase();
158 158
 
159
-        System.out.println("\nHi " + instance.getPlayer().getName() + "! Welcome to BlackJack!\n\nThe minimum bet is $50.\n\n~~~~~~~~~~~~~~~~~~~\n\nHow much would you like to bet?");
159
+        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nHow much would you like to bet?");
160 160
         initialBet = scanner.nextInt();
161 161
         start(initialBet);
162 162
 
@@ -334,7 +334,7 @@ public class BlackJack extends CardGame implements Gamble {
334 334
         blackJackPlayer.setInitialBet(0);
335 335
         blackJackPlayer.setBetPot(0);
336 336
 
337
-        System.out.println("\n\nWould you like to play again?\n<< Yes - No >>");
337
+        System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nWould you like to play again?\n\n<< Yes - No >>");
338 338
         String userInput = scanner.nextLine();
339 339
         String input = userInput.toUpperCase();
340 340
 
@@ -343,7 +343,7 @@ public class BlackJack extends CardGame implements Gamble {
343 343
                 start();
344 344
                 break;
345 345
             case "NO":
346
-                System.out.println("\n\nBYYYYEEEEEE");
346
+                System.out.println("\n~~~~~~~~~~~~~~~~~~~\n\nReturning to the Casino!");
347 347
                 // go back to casino
348 348
                 instance.chooseGame();
349 349
                 break;

+ 120
- 0
src/main/java/io/zipcoder/casino/Casino_test.java 파일 보기

@@ -0,0 +1,120 @@
1
+package io.zipcoder.casino;
2
+
3
+// BlackJack
4
+// Solitaire
5
+// Craps
6
+// Roulette?
7
+// Slot Machine?
8
+
9
+// Jackpot option? Low chance but player wins $1mil
10
+//
11
+
12
+import io.zipcoder.casino.CardGame.BlackJack.BlackJack;
13
+import io.zipcoder.casino.DiceGame.Craps.Craps;
14
+import io.zipcoder.casino.CardGame.Solitaire.Solitaire;
15
+import io.zipcoder.casino.Interfaces.Game;
16
+
17
+import java.util.Scanner;
18
+
19
+public final class Casino_test {
20
+
21
+    private final static Casino_test instance = new Casino_test();
22
+
23
+    private Player player;
24
+
25
+    private final String casinoName = "Thunder Theta";
26
+
27
+    private Casino_test() {
28
+    }
29
+
30
+    public void chooseGame() {
31
+        Scanner scanner = new Scanner(System.in);
32
+        System.out.println("\n\nWhat game would you like to play?\n<< BlackJack - Solitaire - Craps - Leave >>");
33
+        String userInput = scanner.nextLine();
34
+        String input = userInput.toUpperCase();
35
+
36
+        boolean flag = true;
37
+
38
+        while (flag) {
39
+            switch (input) {
40
+                case "SOLITAIRE":
41
+                    break;
42
+                case "BLACKJACK":
43
+                    BlackJack blackJack = new BlackJack(player);
44
+                    System.out.println("\nHi " + instance.getPlayer().getName() + "! Welcome to BlackJack!\n\nThe minimum bet is $50.\n");
45
+                    flag = false;
46
+                    blackJack.start();
47
+                    break;
48
+                case "CRAPS":
49
+                    Craps craps = new Craps(player);
50
+                    flag = false;
51
+                    craps.gamePlay();
52
+                    break;
53
+                case "LEAVE":
54
+                    System.out.println("Thanks for coming to Thunder Theta, good bye!");
55
+                    flag = false;
56
+                    break;
57
+                default:
58
+                    System.out.println("I don't know what that game is. Please try again.");
59
+                    break;
60
+            }
61
+        }
62
+    }
63
+
64
+    public void setPlayer(Player player) {
65
+        this.player = player;
66
+    }
67
+
68
+    public Player getPlayer() {
69
+        return this.player;
70
+    }
71
+
72
+    public static Casino_test getInstance() {
73
+        return instance;
74
+    }
75
+
76
+    public String getCasinoName() {
77
+        return this.casinoName;
78
+    }
79
+
80
+    public static void main(String[] args) {
81
+        Scanner scanner = new Scanner(System.in);
82
+        Casino_test instance = Casino_test.getInstance();
83
+        System.out.println("Welcome to " + instance.getCasinoName() + "! What is your name?");
84
+        String playerName = scanner.nextLine();
85
+        Player player = new Player(playerName);
86
+        instance.setPlayer(player);
87
+        instance.chooseGame();
88
+    }
89
+
90
+//    private int money;
91
+//    private String casinoName;
92
+//    private Game game;
93
+//    private Player player;
94
+//    private String currentGame;
95
+//
96
+//    public void selectGame(int gameNum) {
97
+//
98
+//        switch (gameNum) {
99
+//            case 1:
100
+//                Game blackJack = new BlackJack(player);
101
+//                break;
102
+//            case 2:
103
+//                Game solitaire = new Solitaire(player);
104
+//                break;
105
+//            case 3:
106
+//                Game craps = new Craps(player);
107
+//                break;
108
+//            case 4:
109
+//                leaveCasino();
110
+//                break;
111
+//            default:
112
+//                System.out.println("Input unknown, please pick again.");
113
+//                break;
114
+//        }
115
+//    }
116
+//
117
+//    public void leaveCasino() {
118
+//    }
119
+
120
+}