|
@@ -49,57 +49,29 @@ public class Casino {
|
49
|
49
|
}
|
50
|
50
|
|
51
|
51
|
public void chooseTable() {
|
|
52
|
+ Game game = null;
|
|
53
|
+
|
|
54
|
+ Integer gameChoice = console.getGameChoice();
|
|
55
|
+
|
|
56
|
+ switch(gameChoice){
|
|
57
|
+ case 1:
|
|
58
|
+ game = new Craps();
|
|
59
|
+ break;
|
|
60
|
+ case 2:
|
|
61
|
+ game = new BlackJack();
|
|
62
|
+ break;
|
|
63
|
+ case 3:
|
|
64
|
+ game = new GoFish();
|
|
65
|
+ break;
|
|
66
|
+ }
|
52
|
67
|
|
53
|
|
- console.println("GAME LIST\n");
|
54
|
|
- console.println("1. CRAPS\n");
|
55
|
|
- console.println("2. BLACK JACK\n");
|
56
|
|
- console.println("3. GO FISH\n");
|
57
|
|
- console.println("CHOOSE TABLE\n");
|
58
|
|
- Integer number=console.getIntegerInput("") ;
|
59
|
|
- switch(number){
|
60
|
|
- case 1:
|
61
|
|
- runGame(new Craps());
|
62
|
|
- break;
|
63
|
|
- case 2:
|
64
|
|
- runGame(new BlackJack());
|
65
|
|
- break;
|
66
|
|
- case 3:
|
67
|
|
- runGame(new GoFish());
|
68
|
|
- break;
|
69
|
|
- }
|
|
68
|
+ runGame(game);
|
70
|
69
|
}
|
71
|
70
|
|
72
|
71
|
private void runGame(Game game) {
|
73
|
|
- console.println("WELCOME TO %s", game.getClassName());
|
74
|
72
|
this.game = game;
|
75
|
73
|
}
|
76
|
74
|
|
77
|
|
- public void confirmPlayers() {
|
78
|
|
- boolean isConfirmed = false;
|
79
|
|
- while(!isConfirmed){
|
80
|
|
- console.println("Current Players: ");
|
81
|
|
- for(Player player : players.getPlayers()){
|
82
|
|
- console.println(player.getName());
|
83
|
|
- }
|
84
|
|
- Integer choice = console.getIntegerInput("Choose option:\n (1)Confirm Players\n (2)Add Player\n (3)Remove Player\n");
|
85
|
|
- String name;
|
86
|
|
- switch(choice){
|
87
|
|
- case 1: isConfirmed = true;
|
88
|
|
- break;
|
89
|
|
- case 2: name = console.getStringInput("Enter name of player to add: ");
|
90
|
|
- players.addPlayer(new Player(name));
|
91
|
|
- break;
|
92
|
|
- case 3: name = console.getStringInput("Enter name of player to remove: ");
|
93
|
|
- for(Player player : players.getPlayers()){
|
94
|
|
- if(player.getName() == name)
|
95
|
|
- players.removePlayer(player);
|
96
|
|
- }
|
97
|
|
- break;
|
98
|
|
- default: break;
|
99
|
|
- }
|
100
|
|
- }
|
101
|
|
- }
|
102
|
|
-
|
103
|
75
|
public void bootPlayer() {
|
104
|
76
|
// If player balance is 0, player game over
|
105
|
77
|
for (int i = 0; i < players.getPlayers().size(); i++) {
|