-
Notifications
You must be signed in to change notification settings - Fork 550
[π μ¬μ΄ν΄2 - λ―Έμ (λΈλμ λ² ν )] λ λ λ―Έμ μ μΆν©λλ€. #1117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: junhyung1206
Are you sure you want to change the base?
Changes from all commits
46827cf
fa3545b
0fa9d76
08a0d5f
e0e3e9c
a9b153c
81cf09d
f3b770a
673c8b9
7bf557d
0f6113a
1219979
608e991
ff51566
1448ecf
5c5616e
43cf9f3
ffb8636
3352131
40b3539
093cafe
46f64d4
204b49e
d86c65d
a59d954
0d9c1d3
689def1
ce6e1d1
979a454
eec36bb
ac4041f
549740e
9f9b1ad
cf4b74f
a17415b
617d459
37df140
165d761
746d402
7d05f19
e4f749e
5975349
e8d2141
d00889c
f450cf5
f32a7e0
2c422f3
2ee638e
7a350b0
5c81d06
29d4a82
a24891a
b576718
993cbee
2d68599
7f3db81
dddbb81
60eb5f1
532b754
fdec1f5
7a86e73
7f09403
9287196
a0f7d3c
470cee2
8a35d2c
da9aca3
4090300
d009a90
9e28bcf
9b00b90
4ff3400
759a84e
152369d
a503891
09855c9
1c6d2e9
e938e19
fa372ab
502cd03
bce5c1e
0352a3f
2c8259e
6a0a472
b89bdfa
a6da832
82e0fd7
e70203a
3334884
893679d
c044c8a
2d8075d
e8f7aa8
b44b121
8e70a43
91089f1
1478cf7
d4fd805
c6cc8bd
e9ecd90
794e3aa
47a8d86
9b604f0
1aabb95
c1191f2
1f57816
00f0f79
0b60897
3d671a6
bb4c1b6
78d9e9d
eb915db
10ae24c
8b3307b
bab3934
85b5ef6
c9e8f68
46db82b
0d345d9
f3e64ac
3ee47c3
58f1755
89341d4
ba9b885
3ec339e
52653a9
0da6c59
ebb82b9
8ba8483
ca9274c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,14 @@ | ||
| package controller; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ΄λ² PRμ κΈ°λ₯ μΆκ° κ·λͺ¨μ λΉν΄ commit μκ° κ΅μ₯ν λ§μ νΈμ΄λ€μ. νμ΅ν΄λ³΄λ©΄μ, λλ μ΄κ² μ κ² λμ ν΄λ³΄λ©° λ€μν μλλ₯Ό ν΄λ³΄λ κ²μ μ’μμ. μ΄λ κ² μκ°νλ μ΄μ λ λ€μκ³Ό κ°μ΅λλ€ :
λ¬Όλ‘ μ΄λ€ νλ‘μ νΈμΈμ§μ λ°λΌ, λλ ν 컨벀μ μ λ°λΌ μ»€λ° κ΄λ¦¬λ₯Ό 그리 μ€μνκ² μκ°νμ§ μμ λλ μμ΄μ. νμ§λ§ μ΄ μ°Έμ git μ΄ μ 곡νλ κΈ°λ₯μ λν΄ μμλ³΄κ³ , κΌ νμν κ²λ€λ§ λ΄μμ μ»€λ° κΈ°λ‘μ μ μμ보λ κ²½νμ ν΄λ³΄λ©΄ μ’μ κ² κ°λ€μ :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μΆκ°λ‘, e8f7aa8 μ λ©μμ§λ κ·Έλ¦¬κ³ fix: finalλ‘ μμ κ°μ λ©μμ§λ μ§κΈ λΉμ₯μ μ°κΈ° νΈνμ§λ§, μ»€λ° λ©μμ§λ₯Ό μλμ λ§κ² μ μμ±ν΄λ³΄μ£ :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. νμ λ리μλ©΄, μ΄λ° νμ€ν 리 μ 리λ git κΈ°λ₯μ μ‘°κΈλ§ μ΅νλ 체κ°μ΄ ν λ¬λΌμ Έμ. μ§κΈ λ¨κ³μμλ μ°μ μ΄ λ κ°μ§λΆν° κ°λ³κ² νμ΅ν΄λ³΄λ©΄ λ€μ PRμ΄ ν¨μ¬ κΉλν΄μ§ κ±°μμ. νΉν rebase λ₯Ό νμ©ν git κ΄λ¦¬ μ°μ΅μ μ‘°κΈμ© ν΄λ³΄μλ©΄ μ’μ λ― νλ€μ. :)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ²μμ μ‘°κΈλ§ λ³κ²½ν΄λ 컀λ°μ νλΌκ³ ν΄μμ μ΅κ΄μ μΌλ‘ νμμ΅λλ€. 리뷰νλ μ
μ₯μμλ μ΄ κ³Όμ μ΄ λ§€μ° νΌκ³€ν μ μκ² λ€λΌλ μκ°μ΄ λλλ€. κ·Έλ¦¬κ³ revertλ₯Ό μ¬μ©μ νλ€λ©΄, μ΄λ¬ν κ³Όμ μ΄ μ’ λ μ λ¦¬κ° λμμ κ² κ°μ΅λλ€. κ·Έλ¦¬κ³ μ€νμ μμ κ°μ κ²½μ° νΈμλ₯Ό ν ν λ€λ¦κ² λ°κ²¬μ ν΄μ κ³ μΉλ κ²μ΄ νλ€μμ΅λλ€. μμΌλ‘, μ»€λ° ν λλ λ©μμ§λ₯Ό κΌΌκΌΌν νμΈνκ³ , μ¬μ€ λ³Έλ¬Έ λ΄μ©λ κ°μ΄ μ μ΄μΌνλλ°, κ·Έλ₯ μ λͺ©λ§ μ§κ³ λ겨λ²λ¦¬μ, νλ λΆλΆμ΄ λ°μ±νκ² λ©λλ€. 리뷰λ°μλ μκ°λΆν° κ³ μ³λ³΄λλ‘ νκ² μ΅λλ€. rebaseλ κΈ°λ₯μ μκ³ λ μλλ°, 3-way mergeλ₯Ό ν λ, μΆ©λμ ν΄κ²°μ μ λͺ»νλ©΄ μ΄λ‘νμ§, μ΄μ μΌλ‘ λμκ°κΈ° νλ€ κ² κ°μλ°? λΌλ μκ°μ κ°μ§κ² λμ΄μ, μΌλ° mergeλ‘ μ΅κ΄μ λ€μμμ΅λλ€. μ’ λ κΉκ² 곡λΆλ₯Ό ν΄μΌν κ² κ°μ΅λλ€. |
||
|
|
||
| import domain.Players; | ||
| import domain.participant.Players; | ||
| import domain.betting.Money; | ||
| import domain.participant.Dealer; | ||
| import domain.participant.Player; | ||
| import dto.PlayerHandDto; | ||
| import service.BettingCalculateService; | ||
| import service.GameService; | ||
| import util.HitOption; | ||
| import util.InputHitOptionParser; | ||
| import util.InputBettingParser; | ||
| import view.InputView; | ||
| import view.OutputView; | ||
|
|
||
|
|
@@ -19,13 +23,20 @@ public GameController(InputView inputView, OutputView outputView) { | |
|
|
||
| public void run() { | ||
| Players players = inputPlayers(); | ||
| GameService gameService = new GameService(players); | ||
| Dealer dealer = new Dealer(); | ||
| GameService gameService = new GameService(players, dealer); | ||
| BettingCalculateService bettingCalculateService = new BettingCalculateService(players, dealer); | ||
|
|
||
| playerBetting(players); | ||
| outputView.printStartGame(gameService.startGame()); | ||
|
|
||
| processGame(gameService); | ||
| boolean dealerIsBlackJack = processDealerBlackJack(gameService); | ||
| if (!dealerIsBlackJack) { | ||
| processGame(gameService); | ||
| } | ||
|
|
||
| outputView.printScore(gameService.getTotalScore()); | ||
| outputView.printResults(gameService.calculateResults()); | ||
| outputView.printBettingResults(bettingCalculateService.getBettingResult()); | ||
| } | ||
|
|
||
| private Players inputPlayers() { | ||
|
|
@@ -34,7 +45,7 @@ private Players inputPlayers() { | |
| String rawPlayerNames = inputView.readPlayerNames(); | ||
| return Players.fromString(rawPlayerNames); | ||
| } catch (IllegalArgumentException exception) { | ||
| outputView.printErrorMessage(exception.getMessage()); | ||
| outputView.printInputErrorMessage(exception.getMessage()); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -43,9 +54,20 @@ private HitOption inputHitOption(Player player) { | |
| while (true) { | ||
| try { | ||
| String rawHitOption = inputView.readHitOption(player.getName()); | ||
| return InputHitOptionParser.parseHitOption(rawHitOption); | ||
| return HitOption.of(rawHitOption); | ||
| } catch (IllegalArgumentException exception) { | ||
| outputView.printInputErrorMessage(exception.getMessage()); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private Money inputBettingMoney(Player player) { | ||
| while (true) { | ||
| try { | ||
| String rawBettingMoney = inputView.readBetting(player.getName()); | ||
| return InputBettingParser.parseBettingMoney(rawBettingMoney); | ||
| } catch (IllegalArgumentException exception) { | ||
| outputView.printErrorMessage(exception.getMessage()); | ||
| outputView.printInputErrorMessage(exception.getMessage()); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -57,19 +79,44 @@ private void processGame(GameService gameService) { | |
| dealerTurn(gameService); | ||
| } | ||
|
|
||
| private boolean processDealerBlackJack(GameService gameService) { | ||
| Dealer dealer = gameService.getDealer(); | ||
| if (dealer.isBlackJack()) { | ||
| gameService.endGameImmediately(); | ||
| outputView.printDealerBlackJack(); | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| private void playerTurn(Player player, GameService gameService) { | ||
| while (!player.isBust() && inputHitOption(player) == HitOption.YES) { | ||
| outputView.printHandCard(gameService.playerHit(player)); | ||
| while (player.isRunning() && inputHitOption(player) == HitOption.YES) { | ||
| gameService.hit(player); | ||
| outputView.printHandCard(PlayerHandDto.from(player)); | ||
| } | ||
| if (!player.isBust()) { | ||
| outputView.printHandCard(gameService.getCurrentHand(player)); | ||
|
|
||
| if (player.isRunning()) { | ||
| gameService.stay(player); | ||
| outputView.printHandCard(PlayerHandDto.from(player)); | ||
| } | ||
| } | ||
|
|
||
| private void dealerTurn(GameService gameService) { | ||
| while (gameService.getDealer().isReceiveCard()) { | ||
| gameService.dealerHit(); | ||
| Dealer dealer = gameService.getDealer(); | ||
|
|
||
| while (dealer.isReceiveCard()) { | ||
| gameService.hit(dealer); | ||
| outputView.printDealerReceiveCard(); | ||
| } | ||
|
|
||
| if (dealer.isRunning()) { | ||
| gameService.stay(dealer); | ||
| } | ||
| } | ||
|
|
||
| private void playerBetting(Players players) { | ||
| for (Player player : players) { | ||
| player.bettingMoney(inputBettingMoney(player)); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package domain; | ||
|
|
||
| public final class BlackJackInfo { | ||
| public static final int BLACKJACK_SCORE = 21; | ||
| public static final int SOFT_HAND_PROCESS_SCORE = 10; | ||
| public static final int DEALER_THRESHOLD_SCORE = 16; | ||
| public static final int FIRST_CARD_COUNT = 2; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ν΄λΉ λ΄μ©μ μ κ±°ν μ΄μ κ° κΆκΈν΄μ.
λͺλͺ λ€λ₯Έ ν¬λ£¨λ€λ μ κ±°νλ λ― νλλ°, μ΄μ λ μ¬μ©νμ§ μλ ν νλ¦Ώ λ΄μ©μΈκ°μ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ°ν μ½ κΉνλΈ μͺ½μμ μΌκ΄μ μΌλ‘ μ κ±°ν κ² κ°μ΅λλ€.