-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathApplication.java
More file actions
59 lines (48 loc) · 1.82 KB
/
Application.java
File metadata and controls
59 lines (48 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import Domain.Player;
import Service.BlackJackGame;
import view.inputView;
import view.outputView;
import java.io.OutputStream;
public class Application {
public static void main(String[] args) {
outputView.outputPlayerNames();
String[] playerNames = inputView.inputPlayerNames();
outputView.outputPlayerInfo(playerNames);
BlackJackGame game = new BlackJackGame();
game.registerParticipant(playerNames);
game.registerDealer();
// <-- 등록
for(Player player : game.playerList){
outputView.outputBettingPrice(player.getName());
player.bettingPrice = inputView.inputPlayerBettingPrice();
}
// 카드 OPEN -->
outputView.outputParticipantCardInfo(game.dealer);
game.playerList.forEach(outputView::outputParticipantCardInfo);
// <-- 카드 OPEN
// 플레이어 MORE 카드 -->
for(Player player : game.playerList){
while(!player.isBurst()){
outputView.outputMoreCard(player.getName());
if(inputView.inputIsMoreCard()){
game.participantAddCard(player);
outputView.outputParticipantCardInfo(player);
continue;
}
break;
}
}
// <-- 플레이어 MORE 카드
while (game.checkDealerScore()){
game.participantAddCard(game.dealer);
outputView.outputDealerCard();
}
// 딜러 hidden card 오픈
game.dealerCardOpen();
outputView.outputParticipantResult(game.dealer);
game.playerList.forEach(outputView::outputParticipantResult);
// game.calculrateGame();
game.calcurateBettingPrice();
outputView.outputBettingResult(game.dealer, game.playerList);
}
}