Skip to content

[๐Ÿš€ ์‚ฌ์ดํด2 - ๋ฏธ์…˜ (๋ธ”๋ž™์žญ ๋ฒ ํŒ…)] ๋‚˜๋ฌด ๋ฏธ์…˜ ์ œ์ถœํ•ฉ๋‹ˆ๋‹ค.#1137

Merged
Choi-JJunho merged 35 commits intowoowacourse:symfleefrom
symflee:step2
Mar 21, 2026

Conversation

@symflee
Copy link
Copy Markdown

@symflee symflee commented Mar 17, 2026

์ฒดํฌ ๋ฆฌ์ŠคํŠธ

  • ๋ฏธ์…˜์˜ ํ•„์ˆ˜ ์š”๊ตฌ์‚ฌํ•ญ์„ ๋ชจ๋‘ ๊ตฌํ˜„ํ–ˆ๋‚˜์š”?
  • Gradle test๋ฅผ ์‹คํ–‰ํ–ˆ์„ ๋•Œ, ๋ชจ๋“  ํ…Œ์ŠคํŠธ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ํ†ต๊ณผํ–ˆ๋‚˜์š”?
  • ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ •์ƒ์ ์œผ๋กœ ์‹คํ–‰๋˜๋‚˜์š”?

์–ด๋–ค ๋ถ€๋ถ„์— ์ง‘์ค‘ํ•˜์—ฌ ๋ฆฌ๋ทฐํ•ด์•ผ ํ• ๊นŒ์š”?

๊ฒŒ์ž„ ์ง„ํ–‰์„ Controller์—์„œ ์–ด๋””๊นŒ์ง€ ๋‹ค๋ฃจ๋Š” ๊ฒƒ์ด ํ—ˆ์šฉ๋˜๋Š”์ง€

ํ˜„์žฌ๋Š” playPhase(Dealer, Players) ์•ˆ์—์„œ

  • ํ”Œ๋ ˆ์ด์–ด๋“ค์„ ์ˆœํšŒํ•˜๋ฉฐ ๊ฐ ํ”Œ๋ ˆ์ด์–ด ํ„ด์„ ์ง„ํ–‰ํ•˜๊ณ 
  • ํ”Œ๋ ˆ์ด์–ด ํ„ด์—์„œ๋Š” ์‚ฌ์šฉ์ž ์ž…๋ ฅ์„ ๋ฐ›์•„ ์นด๋“œ๋ฅผ ๋” ๋ฐ›์„์ง€ ๊ฒฐ์ •ํ•˜๊ณ 
  • ๋”œ๋Ÿฌ๋Š” ๋ณ„๋„ while ๋ฌธ์œผ๋กœ ํ„ด์„ ์ง„ํ–‰ํ•˜๋Š”

ํ˜•ํƒœ์ž…๋‹ˆ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ์ด ๊ตฌ์กฐ๋Š” Controller๊ฐ€ ๊ฒŒ์ž„์˜ ํ๋ฆ„์„ ๋„ˆ๋ฌด ๋งŽ์ด ์ง์ ‘ ๋‹ค๋ฃจ๋Š” ๊ฒƒ ๊ฐ™๊ธฐ๋„ ํ•˜๊ณ , ๋ฐ˜๋Œ€๋กœ ํ”Œ๋ ˆ์ด์–ด ํ„ด์€ ์‚ฌ์šฉ์ž ์ž…๋ ฅ์ด ํ•„์š”ํ•ด์„œ ๋„๋ฉ”์ธ ์•ˆ์œผ๋กœ ๋„ฃ๊ธฐ๋„ ์• ๋งคํ•˜๊ฒŒ ๋А๊ปด์ง‘๋‹ˆ๋‹ค.

์ œ๊ฐ€ ๊ถ๊ธˆํ•œ ์ ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  • ํ˜„์žฌ์˜ ํ”Œ๋ ˆ์ด์–ด ์ˆœํšŒ์™€ ํ„ด ์ง„ํ–‰์€ ๊ผญ Controller๊ฐ€ ์•„๋‹ˆ๋”๋ผ๋„ ์™ธ๋ถ€์—์„œ ๋งก๋Š” ๊ฒƒ๋„ ํ—ˆ์šฉ๋˜๋Š” ์ˆ˜์ค€์ธ์ง€, ์•„๋‹ˆ๋ฉด ๋„๋ฉ”์ธ ์ชฝ์œผ๋กœ ๋” ์˜ฎ๊ฒจ๊ฐ€๋Š” ๊ฒƒ์ด ์ข‹์€์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.
  • ๊ฒฐ๊ณผ์ ์œผ๋กœ๋Š” playPhase(Dealer, Players)๋ฅผ readyPhase(Participants)์ฒ˜๋Ÿผ playPhase(Participants)์œผ๋กœ ์ˆ˜์ •ํ•˜๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ, ์ด๋Ÿฐ ๋ฐฉํ–ฅ์ด ๊ดœ์ฐฎ์€ ๊ฒƒ์ธ์ง€๋„ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.
    (https://github.com/woowacourse/java-blackjack/pull/1137/changes#diff-bf343d0582705538ce76c37ebbe336f7a98051e3b9b8386f9bb31329d6deb2eaR55)

๋ฐฐํŒ… ์ •๋ณด๋ฅผ Player๊ฐ€ ์ง์ ‘ ๊ฐ€์ ธ์•ผ ํ•˜๋Š”์ง€, ๋ณ„๋„ ๊ฐ์ฒด๊ฐ€ ๊ด€๋ฆฌํ•ด์•ผ ํ•˜๋Š”์ง€

์ฒ˜์Œ์—๋Š” Player๊ฐ€ ๋ฐฐํŒ… ๊ธˆ์•ก์„ ์ง์ ‘ ๊ฐ€์ง€๋Š” ๋ฐฉํ–ฅ๋„ ์ƒ๊ฐํ–ˆ๋Š”๋ฐ, ๋ฐฐํŒ… ์ƒํ™ฉ์„ BettingTable ๊ฐ™์€ ๋ณ„๋„ ๊ฐ์ฒด๊ฐ€ ๊ด€๋ฆฌํ•˜๋Š” ๊ฒƒ์ด ๋” ๋‚ซ์ง€ ์•Š์„๊นŒ ๊ณ ๋ฏผํ–ˆ์Šต๋‹ˆ๋‹ค.

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ํ”Œ๋ ˆ์ด์–ด ์ž์ฒด์™€ ๋ฐฐํŒ… ์ƒํ™ฉ์„ ๋ถ„๋ฆฌํ•  ์ˆ˜ ์žˆ๊ณ , ๋‚˜์ค‘์— ๊ฒŒ์ž„์„ ์—ฌ๋Ÿฌ ๋ฒˆ ์ง„ํ–‰ํ•˜๋Š” ๊ตฌ์กฐ๋กœ๋„ ํ™•์žฅํ•˜๊ธฐ ์‰ฌ์šธ ๊ฒƒ ๊ฐ™๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.

  • Player๊ฐ€ ๋ฐฐํŒ… ๊ธˆ์•ก์„ ์ง์ ‘ ๊ฐ€์ง€๋Š” ๊ฒƒ๋ณด๋‹ค, BettingTable์ด๋‚˜ PlayerBet ๊ฐ™์€ ๋ณ„๋„ ๊ฐ์ฒด๊ฐ€ ๊ด€๋ฆฌํ•˜๋Š” ์ชฝ์ด ๋” ์ข‹์€๊ฑธ๊นŒ์š”?
  • PlayerBet์ด Player ์ž์ฒด๋ฅผ ๋“ค๊ธฐ๋ณด๋‹ค Name๊ณผ BettingAmount๋งŒ ๊ฐ€์ง€๋„๋ก ๋ถ„๋ฆฌํ•˜๋Š” ๋ฐฉํ–ฅ์€ ์ ์ ˆํ•œ์ง€๋„ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.

์ถ”๊ฐ€ ๊ธฐ๋Šฅ ๊ตฌํ˜„๊ณผ ๋ฆฌํŒฉํ† ๋ง์˜ ์šฐ์„ ์ˆœ์œ„๋Š” ์–ด๋–ค ๊ธฐ์ค€์œผ๋กœ ์ •ํ•ด์•ผํ• ์ง€

๋ฐฐํŒ… ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ณผ์ •์—์„œ ๊ธฐ์กด ์ฝ”๋“œ์˜ ๋งŽ์€ ๋ถ€๋ถ„์„ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‹ค๋ณด๋‹ˆ ๋„ˆ๋ฌด ๋งŽ์€ ๋ณ€๊ฒฝ์ ์ด ์ƒ๊ธฐ๊ฒŒ ๋˜์—ˆ๊ณ , ์–ด๋””๊นŒ์ง€ ์ˆ˜์ •์„ ํ•ด์•ผํ•  ์ง€ ๋˜ ๊ฑฐ๊ธฐ์„œ ์–ด๋””์„œ๋ถ€ํ„ฐ ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•  ์ง€ ํ’€์–ด๋‚˜๊ฐ€๋Š” ๊ฒƒ์ด ์กฐ๊ธˆ ํž˜๋“ค์—ˆ์Šต๋‹ˆ๋‹ค.

๊ทธ๋Ÿฌ๋‹ค๋ณด๋‹ˆ ์ด๋Ÿฐ ์˜๋ฌธ์ด ์ƒ๊ฒผ์Šต๋‹ˆ๋‹ค

  • ๋ฆฌํŒฉํ† ๋ง์„ ์ˆ˜ํ–‰ํ•œ ๋’ค, ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ
  • ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•œ ๋’ค, ๋ฆฌํŒฉํ† ๋ง์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ

๋‘˜ ์ค‘ ์šฐ์„ ๋˜๋Š” ๋ฐฉํ–ฅ์ด ์žˆ์„๊นŒ์š”? ๋˜๋Š” ๋‘ ๋ฐฉ์‹ ์ค‘ ์„ ํƒํ•  ๋•Œ ์ฐธ๊ณ ํ•  ๋งŒํ•œ ๊ธฐ์ค€์ด ์žˆ์„๊นŒ์š”?

์งˆ๋ฌธ์„ ์œ„ํ•ด์„œ ์–ด๋””๊นŒ์ง€ ์Šค์Šค๋กœ ๊ณ ๋ฏผํ•ด๋ณด์•„์•ผ ํ•˜๋Š”์ง€

๊ณ ๋ฏผ์ด ์–•์œผ๋ฉด ์งˆ๋ฌธ์ด ๋„ˆ๋ฌด ๊ฐ€๋ณ๊ณ , ๊ณ ๋ฏผ์ด ๊นŠ์œผ๋ฉด ์˜คํžˆ๋ ค ๊ผฌ๋ฆฌ ์งˆ๋ฌธ์ด ๊ณ„์† ์ƒ๊ฒจ ์ดˆ๊ธฐ ์˜๋ฌธ์˜ ๋ฐฉํ–ฅ์„ ์žƒ์–ด๋ฒ„๋ฆฌ๊ณค ํ–ˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์‹ค ์ด ๋ฌธ์ œ ๋•Œ๋ฌธ์— ๋”์šฑ ์ •์‹ ์—†๋Š” ๋ฏธ์…˜ ์ง„ํ–‰์ด ๋˜์—ˆ๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์Ÿ์•„์ง€๋Š” ์ƒˆ๋กœ์šด ๊ฐœ๋…๊ณผ ์ƒˆ๋กญ๊ฒŒ ๋ณด์ด๋Š” ๋ฌธ์ œ์ ๋“ค์„ ๊ฐ๋‹นํ•˜๊ธฐ ์–ด๋ ค์› ๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์ฃผ๋…ธ๋Š” ์ด๋Ÿฐ ์ƒํ™ฉ์—์„œ ์งˆ๋ฌธ์˜ ์ ์ ˆํ•œ ๊นŠ์ด์™€ ํƒ€์ด๋ฐ์„ ์žก๋Š” ๊ธฐ์ค€์œผ๋กœ ์žˆ๋Š” ์ง€ ์—ฌ์ญค๋ณด๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.


Copy link
Copy Markdown

@kang-hyungu kang-hyungu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋‚˜๋ฌด ๋ช‡ ๊ฐ€์ง€ ํ”ผ๋“œ๋ฐฑ ๋‚จ๊ฒผ์–ด์š”
ํ™•์ธํ•ด๋ณด์‹œ๊ณ  ๊ถ๊ธˆํ•œ ์  ์žˆ์œผ๋ฉด ์งˆ๋ฌธ์ฃผ์„ธ์š”~

Comment thread src/main/java/Game.java
@@ -28,17 +37,64 @@ public GameController(InputView inputView, OutputView outputView, GameManager ma
public void run() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํด๋ž˜์Šค๋ช…์— ์ปจํŠธ๋กค๋Ÿฌ๋ผ๊ณ  ๋ถ™์ธ ์ด์œ ๊ฐ€ ๋ญ”๊ฐ€์š”?


private void readyPhase(Dealer dealer, Players players) {
gameManager.dealStartingCards(dealer);
gameManager.dealCardTo(players, 2);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2๊ฐ€ ๋ญ˜ ์˜๋ฏธํ•˜์ฃ ? ์ƒ์ˆ˜๋กœ ์ถ”์ถœํ•ด์„œ ์˜๋ฏธ ์žˆ๋Š” ์ด๋ฆ„์„ ๋ถ€์—ฌํ•ด์ฃผ์„ธ์š”
๋‹ค๋ฅธ ํŒ€์›์ด ์ฝ”๋“œ๋ฅผ ๋ณด๊ณ  ๋ฌด์—‡์„ ์˜๋ฏธํ•˜๋Š”์ง€ ๋ฐ”๋กœ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜์„ธ์š”

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋„ต
INITIAL_CARD_COUNT ๋ผ๋Š” ์ด๋ฆ„์„ ๋ถ€์—ฌํ•˜๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

gameManager.dealStartingCards(dealer);
gameManager.dealCardTo(players, 2);

Map<String, CardsSnapshot> result = new LinkedHashMap<>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฒŒ์ž„ ๊ฒฐ๊ณผ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์ƒˆ๋กœ ์ถ”๊ฐ€ํ•ด์„œ ๊ทธ ๊ฐ์ฒด์—๊ฒŒ ์ด ์ž‘์—…์„ ๋งก๊ธฐ๋Š” ๊ฒƒ๋„ ๊ดœ์ฐฎ๊ฒ ๋„ค์š”

outputView.printInitialDealingResult(initialDealingResult);
}

private void resultPhase(Dealer dealer, Players players) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ์ฝ”๋“œ๋„ ๊ฒŒ์ž„ ๊ฒฐ๊ณผ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๊ฐ์ฒด์—์„œ ์ฒ˜๋ฆฌํ•ด๋„ ๋˜์ง€ ์•Š์„๊นŒ์š”?
์ง€๊ธˆ ๊ฐ™์€ ๊ตฌ์กฐ๋ผ๋ฉด ๊ฒฐ๊ณผ๋ฅผ ๋‹ค๋ฃจ๋Š” ๋กœ์ง์„ ๋‹ค๋ฅธ ์ฝ”๋“œ์—์„œ๋Š” ์žฌ์‚ฌ์šฉ์„ ๋ชปํ•˜๊ฒ ๋„ค์š”

this.value = value;
}

public static BettingAmount of(int value) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํŒฉํ„ฐ๋ฆฌ ๋ฉ”์„œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•œ ์ด์œ ๊ฐ€ ๋ญ”๊ฐ€์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์†”์งํ•˜๊ฒŒ ๋ง์”€๋“œ๋ฆฌ๋ฉด, ์ •์  ํŒฉํ„ฐ๋ฆฌ ๋ฉ”์„œ๋“œ์— ๋Œ€ํ•ด ํ•™์Šตํ•˜๊ณ  ์ ์šฉํ–ˆ๋˜ ๊ฒƒ์€ ์•„๋‹ˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๋‹จ์ˆœํžˆ '์ •์  ํŒฉํ„ฐ๋ฆฌ ๋ฉ”์„œ๋“œ๊ฐ€ ์ผ๋ฐ˜ ์ƒ์„ฑ์ž๋ณด๋‹ค ์˜๋„๋ฅผ ๋ช…ํ™•ํžˆ ์ „๋‹ฌํ•˜๊ณ  ๊ฐ€๋…์„ฑ์„ ๋†’์—ฌ์ฃผ๊ธฐ ๋•Œ๋ฌธ์— ์šฐ์„ ์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค' ์ •๋„๋กœ๋งŒ ์–•๊ฒŒ ์•Œ๊ณ  ๊ธฐ๊ณ„์ ์œผ๋กœ ์ ์šฉํ–ˆ๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์•Œ์•„๋ณด๊ณ ๋‚˜๋‹ˆ, ํ•ด๋‹น ํด๋ž˜์Šค์ฒ˜๋Ÿผ ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ํ•˜๋‚˜๋ฟ์ด๊ณ  ์ƒ์„ฑ๊ณผ์ •์ด ๋‹จ์ˆœํ•œ ํด๋ž˜์Šค์—์„œ๋Š” ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ๊ฐ€ ์ฃผ๋Š” ์ด์ ์ด ์‚ฌ์‹ค์ƒ ์—†๋‹ค๋Š” ๊ฒƒ์„ ๋А๊ผˆ์Šต๋‹ˆ๋‹ค. ์˜คํžˆ๋ ค ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ๋กœ ์ƒ์„ฑ์ž๋ฅผ ๋ถˆํ•„์š”ํ•˜๊ฒŒ ํ•œ ๋ฒˆ ๋” ๊ฐ์‹ธ ์ฝ”๋“œ๊ฐ€ ๋Š˜์–ด๋‚ฌ๋‹ค๊ณ  ์ƒ๊ฐ๋ฉ๋‹ˆ๋‹ค.

return new BettingTable(bettingTable);
}

public void add(PlayerBetting playerBetting) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ•จ์ˆ˜๋ช…์„ add ๋ณด๋‹ค ๊ฒŒ์ž„ ์šฉ์–ด๋กœ ์ ์šฉํ•ด๋ณด๋ฉด ์–ด๋–จ๊นŒ์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฒŒ์ž„์—์„œ ๋ฒ ํŒ…ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ํ‘œํ˜„์ธ 'place a bet'์—์„œ ๋ฉ”์„œ๋“œ๋ช…์„ place๋กœ ์ˆ˜์ •ํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

์™ธ๋ถ€์˜ placeBet์ด๋ผ๋Š” ๋ฉ”์„œ๋“œ ์•ˆ์—์„œ bettingTable.place(playerBet) ํ˜•ํƒœ๋กœ ํ˜ธ์ถœํ•˜๊ฒŒ ๋˜๋Š”๋ฐ ์ด๋Ÿฌํ•œ ๋„ค์ด๋ฐ์ด ์ ์ ˆํ• ๊นŒ์š”?

}

private int calculateDealerProfit(List<PlayerProfitResult> playersProfitResult) {
return (-1) * playersProfitResult.stream()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์—ฌ๊ธฐ๋Š” ์™œ -1์„ ๊ณฑํ•˜๋‚˜์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋”œ๋Ÿฌ์˜ ์ˆ˜์ต์€ ํ”Œ๋ ˆ์ด์–ด๋“ค ์ˆ˜์ต ํ•ฉ์˜ ๋ฐ˜๋Œ€๋ผ๋Š” ์ ์„ ์ง๊ด€์ ์œผ๋กœ ๋‚˜ํƒ€๋‚ด๊ณ  ์‹ถ์—ˆ์Šต๋‹ˆ๋‹ค.

์ฒ˜์Œ์— - ๊ธฐํ˜ธ๋งŒ ๋ถ™์ด๋Š” ๊ฒƒ๋ณด๋‹ค ๋ณด๋‹ค ๋ช…์‹œ์ ์œผ๋กœ ๋ณด์ด๋„๋ก * (-1)์„ ์‚ฌ์šฉํ–ˆ์—ˆ๋Š”๋ฐ, -1 ์—ญ์‹œ ๋ฌธ๋งฅ์„ ๋ชจ๋ฅด๋ฉด ์ดํ•ดํ•˜๊ธฐ ํž˜๋“  ๋งค์ง ๋„˜๋ฒ„๋ผ๋Š” ์ ์„ ๊ฐ„๊ณผํ–ˆ์Šต๋‹ˆ๋‹ค.

์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒจ์ฃผ์‹  ๋•๋ถ„์— ์•Œ์•„๋ณด๋Š” ๊ณผ์ •์—์„œ ๋ถ€ํ˜ธ๋ฅผ ๋ฐ˜์ „์‹œํ‚ค๋Š” Math.negateExact() ๋ฉ”์„œ๋“œ๋ฅผ ์ƒˆ๋กญ๊ฒŒ ์•Œ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์˜๋„๊ฐ€ ๋” ๋ช…ํ™•ํ•˜๊ฒŒ ๋“œ๋Ÿฌ๋‚˜๊ณ  ๋งค์ง ๋„˜๋ฒ„๋„ ์ œ๊ฑฐํ•  ์ˆ˜ ์žˆ์–ด ํ•ด๋‹น ๋ฐฉ์‹์œผ๋กœ ์ˆ˜์ •ํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.


import java.util.List;

public record ParticipantsProfitResult(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result๋ฅผ ํด๋ž˜์Šค๋ช…์— ๋ถ™์ผ ํ•„์š”๊ฐ€ ์žˆ์„๊นŒ์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฒŒ์ž„์ด ์ข…๋ฃŒ๋œ ์ดํ›„์— profit์ด ๊ฒฐ์ •๋˜๊ธฐ ๋•Œ๋ฌธ์— profit๋งŒ์œผ๋กœ ๊ฒฐ๊ณผ๋ผ๋Š” ์˜๋ฏธ๋ฅผ ์ถฉ๋ถ„ํžˆ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ์–ด, result๋Š” ๋ถ™์ผ ํ•„์š”๊ฐ€ ์—†๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ์ˆ˜์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

import domain.participant.Name;
import domain.participant.Player;

public record PlayerBetting(Name playerName, BettingAmount bettingAmount) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ”Œ๋ ˆ์ด์–ด ๋ฒ ํŒ…์€ ์–ด๋–ค ์˜๋„๋กœ ๋ถ™์ธ ์ด๋ฆ„์ผ๊นŒ์š”? ๋ฒ ํŒ…ํ•˜๋‹ค? ๊ทธ๋ƒฅ ๋ง ๊ทธ๋Œ€๋กœ ๋ฒ ํŒ…?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ”Œ๋ ˆ์ด์–ด์˜ ๋ฐฐํŒ…์ด๋ผ๋Š” ์˜๋ฏธ๋ฅผ ๋‹ด๊ณ  ์‹ถ์—ˆ์Šต๋‹ˆ๋‹ค.

PlayerBetting๋ณด๋‹ค PlayerBet์ด ๋” ์˜๋„์— ๊ฐ€๊น๋‹ค๊ณ  ์ƒ๊ฐ๋ผ ์ด๋ฆ„์„ ๋ณ€๊ฒฝํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

๋‹ค๋งŒ ์ด ์ด๋ฆ„์ด ์‹ค์ œ๋กœ๋„ ์ž์—ฐ์Šค๋Ÿฌ์šด์ง€์—๋Š” ์•„์ง ํ™•์‹ ์ด ์—†์Šต๋‹ˆ๋‹ค.
ํ˜น์‹œ ๋ณด์‹œ๊ธฐ์— ๋” ์ ์ ˆํ•œ ๋„ค์ด๋ฐ์ด ์žˆ๋‹ค๋ฉด ์˜๊ฒฌ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

์ด๋Ÿฐ ์‹์œผ๋กœ ํ”Œ๋ ˆ์ด์–ด์™€ ๋ฐฐํŒ… ๊ธˆ์•ก์„ ํ•จ๊ป˜ ๋ฌถ๋Š” ํ˜„์žฌ ๊ตฌ์„ฑ ์ž์ฒด๋„ ๊ดœ์ฐฎ์€ ๋ฐฉํ–ฅ์ธ์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค!

@@ -14,7 +14,7 @@ public record CardsSnapshot(List<Card> cards) {

public String getFormattedCards() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ๋ฉ”์„œ๋“œ๊ฐ€ ๋„๋ฉ”์ธ ๊ฐ์ฒด์— ํ•„์š”ํ•œ๊ฐ€์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ•„์š”ํ•˜์ง€ ์•Š๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.
์ถœ๋ ฅ์šฉ ๋ฌธ์ž์—ด์„ ๋งŒ๋“œ๋Š” ์ฑ…์ž„์€ ํ•ด๋‹น ํด๋ž˜์Šค๊ฐ€ ์•„๋‹ˆ๋ผ ์ถœ๋ ฅ ๊ณ„์ธต์— ์žˆ์–ด์•ผ ํ•œ๋‹ค๊ณ  ๋ดค์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ ์ด๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๊ณผ์ •์—์„œ ๋ณ€๊ฒฝ ๋ฒ”์œ„๊ฐ€ ์ปค์กŒ๊ณ , ์‚ฌ์ดํด2์˜ ๋ฐฐํŒ… ๊ธฐ๋Šฅ ๊ตฌํ˜„๊ณผ ํ•จ๊ป˜ ์ง„ํ–‰ํ•˜๊ธฐ์—๋Š” ๋ถ€๋‹ด์ด ํฌ๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.
๊ทธ๋ž˜์„œ ๋ณ„๋„ ํด๋ž˜์Šค๋กœ ๋ถ„๋ฆฌํ•ด ์ ์ง„์ ์œผ๋กœ ์˜ฎ๊ธฐ๋Š” ๋ฐฉํ–ฅ์„ ํƒํ–ˆ๊ณ , ๊ทธ ๊ณผ์ •์—์„œ ๊ธฐ์กด ๋ฉ”์„œ๋“œ๊ฐ€ ๋‚จ์•„ ์žˆ๋Š” ์ƒํƒœ๋กœ ์ œ์ถœํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

Comment thread src/main/java/domain/DeckShuffler.java
Comment thread src/main/java/domain/Command.java
Copy link
Copy Markdown
Member

@Choi-JJunho Choi-JJunho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋‚˜๋ฌด~ ๋ฏธ์…˜ ์ˆ˜ํ–‰ํ•˜๋А๋ผ ๊ณ ์ƒ๋งŽ์œผ์…จ์Šต๋‹ˆ๋‹ค!
๊ตฌ๊ตฌ๊ฐ€ ๋ฆฌ๋ทฐ๋ฅผ ๊ฐ™์ด ๋‚จ๊ฒจ์ฃผ์…”์„œ ๊นœ์ง ๋†€๋ž๋„ค์š” ใ…Žใ…Ž ๐Ÿ˜…
๊ตฌ๊ตฌ์˜ ์ฝ”๋ฉ˜ํŠธ์—๋„ ๊ฐ™์ด ๋‹ต๋ณ€์„ ๋‚จ๊ฒจ์ฃผ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค ๐Ÿ‘

step2๋„ ํ™”์ดํŒ…์ž…๋‹ˆ๋‹ค!

Comment thread src/test/java/domain/GameManagerTest.java Outdated
Comment thread src/main/java/domain/Deck.java Outdated
Comment thread src/main/java/Game.java
Comment on lines +55 to 60
private void readyPhase(Participants participants) {
gameManager.dealInitialCards(participants);

InitialDealingResult initialDealingResult = InitialDealingResult.from(participants);
outputView.printInitialDealingResult(initialDealingResult);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ˜„์žฌ์˜ ํ”Œ๋ ˆ์ด์–ด ์ˆœํšŒ์™€ ํ„ด ์ง„ํ–‰์€ ๊ผญ Controller๊ฐ€ ์•„๋‹ˆ๋”๋ผ๋„ ์™ธ๋ถ€์—์„œ ๋งก๋Š” ๊ฒƒ๋„ ํ—ˆ์šฉ๋˜๋Š” ์ˆ˜์ค€์ธ์ง€, ์•„๋‹ˆ๋ฉด ๋„๋ฉ”์ธ ์ชฝ์œผ๋กœ ๋” ์˜ฎ๊ฒจ๊ฐ€๋Š” ๊ฒƒ์ด ์ข‹์€์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.
๊ฒฐ๊ณผ์ ์œผ๋กœ๋Š” playPhase(Dealer, Players)๋ฅผ readyPhase(Participants)์ฒ˜๋Ÿผ playPhase(Participants)์œผ๋กœ ์ˆ˜์ •ํ•˜๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ, ์ด๋Ÿฐ ๋ฐฉํ–ฅ์ด ๊ดœ์ฐฎ์€ ๊ฒƒ์ธ์ง€๋„ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค. commit

ํ—ˆ์šฉ๋˜๋Š” ์ˆ˜์ค€ ํ˜น์€ ์ •๋‹ต์€ ์—†์Šต๋‹ˆ๋‹ค!
๋‚˜๋ฌด๊ฐ€ ์ด๋ ‡๊ฒŒ ์ˆ˜์ •ํ•˜๊ฒŒ๋œ ์ด์œ ์™€ ์ด๋ ‡๊ฒŒ ์ˆ˜์ •ํ–ˆ์„ ๋•Œ ์–ด๋–ค ์ฐจ์ด๊ฐ€ ์žˆ์—ˆ๋Š”์ง€ ํ•œ๋ฒˆ ์ด์•ผ๊ธฐํ•ด์ฃผ์‹ค ์ˆ˜ ์žˆ๋‚˜์š”~?

Copy link
Copy Markdown
Author

@symflee symflee Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ธฐ์กด์—๋Š” ์ดˆ๊ธฐ ์นด๋“œ ์ง€๊ธ‰๊ณผ ์ถœ๋ ฅ์šฉ ๋ฐ์ดํ„ฐ ์กฐ๋ฆฝ์„ ํ•˜๋‚˜์˜ ํด๋ž˜์Šค๊ฐ€ ๋‹ด๋‹นํ•˜๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์ดˆ๊ธฐ ์นด๋“œ ์ง€๊ธ‰์€ GameManager๊ฐ€, ์ถœ๋ ฅ์šฉ ๋ฐ์ดํ„ฐ ์ƒ์„ฑ์€ ๋ณ„๋„์˜ ๊ฐ์ฒด๊ฐ€ ๋‹ด๋‹นํ•˜๋„๋ก ๋ถ„๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ทธ ๊ฒฐ๊ณผ ๊ฒŒ์ž„ ํ๋ฆ„ ์ œ์–ด์— ๋” ์ง‘์ค‘ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๊ณ , ์ดˆ๊ธฐ ์นด๋“œ ์ง€๊ธ‰ ๊ทœ์น™๋„ ํ•œ ๊ณณ์— ๋ชจ์—ฌ ์‘์ง‘๋„๊ฐ€ ๋†’์•„์กŒ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ dealInitialCards(participants)์ฒ˜๋Ÿผ ๊ฐ€๋…์„ฑ๋„ ์ข‹์•„์กŒ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์Šต๋‹ˆ๋‹ค~! ๋ถ„๋ฆฌํ•œ ์ด์œ ์™€ ๊ทธ์— ๋”ฐ๋ฅธ ์ด์ ์„ ์ž˜ ์„ค๋ช…ํ•ด์ฃผ์…จ๋„ค์š”!
๋‚˜๋ฌด๊ฐ€ ์ด์•ผ๊ธฐํ•ด์ฃผ์‹  dealInitialCards(participants) ํ˜•ํƒœ๋กœ ๊ฐ€๋…์„ฑ์ด ์ข‹์•„์ง„ ๋ถ€๋ถ„๋„ ๋™์˜ํ•ฉ๋‹ˆ๋‹ค. ๐Ÿ‘

๋‹ค๋ฅธ ํฌ๋ฃจ๋“ค๊ณผ๋„ ์ด์•ผ๊ธฐ๋ฅผ ๋‚˜๋ˆ ๋ณด๋ฉด์„œ ๋‚˜๋ฌด๊ฐ€ ์ƒ๊ฐํ•˜๋Š” ํƒ€๋‹นํ•œ ์˜๊ฒฌ์„ ๊ฒฌ๊ณ ํžˆ ๋‹ค์ ธ๊ฐ€๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค ๐Ÿ’ช

private static final int HIT_THRESHOLD = 16;

public Dealer() {
super(new Name(DEFAULT_NAME));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ง€๋‚œ ๋ฆฌ๋ทฐ์—์„œ ์ œ๊ฐ€ ๋ฏธ์ฒ˜๋ฐœ๊ฒฌ ๋ชปํ•œ ๋ถ€๋ถ„์ด์˜€๋Š”๋ฐ์š” ๐Ÿฅน
์ง€๊ธˆ Name์˜ ์ •์  ๋ฉ”์„œ๋“œ์—๋งŒ ์ด๋ฆ„ validate๊ฐ€ ๋“ค์–ด๊ฐ€๊ณ ์žˆ์–ด์š”

    public static Name from(String rawName) {
        validate(rawName);

        return new Name(rawName);
    }

์ด ๊ฒฝ์šฐ ์—ฌ๊ธฐ ๋”œ๋Ÿฌ์—์„œ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ ์ฒ˜๋Ÿผ new Name(..) ์œผ๋กœ ์ƒ์„ฑ๋œ ๊ฑด์— ๋Œ€ํ•ด์„œ๋Š” ๊ฒ€์ฆ์ด ์•ˆ๋ ๊ฑฐ๊ฐ™์•„์š”!
์–ด๋–ป๊ฒŒ ์ˆ˜์ •ํ•ด๋ณด๋ฉด ์ข‹์„๊นŒ์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ง์”€ํ•ด ์ฃผ์‹  ๊ฒƒ ์ฒ˜๋Ÿผ ๊ธฐ๋ณธ ์ƒ์„ฑ์ž๋กœ ์ƒ์„ฑํ•  ๊ฒฝ์šฐ ๊ฒ€์ฆ์ด ๋ˆ„๋ฝ๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๊ธฐ๋ณธ ์ƒ์„ฑ์ž์— ๊ฒ€์ฆ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๋„๋ก ํ•˜๊ณ , ์ •์  ๋ฉ”์„œ๋“œ์—์„œ ๊ธฐ๋ณธ ์ƒ์„ฑ์ž๋ฅผ ํ˜ธ์ถœํ•ด ๋ฐ˜ํ™˜ํ•˜๋„๋ก ์ˆ˜์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์Šต๋‹ˆ๋‹ค~ record์—์„œ๋Š” ๊ธฐ๋ณธ์ƒ์„ฑ์ž์— ๋Œ€ํ•œ ๊ฒ€์ฆ์„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค

    public Name {
        validate(value);
    }

๊ทธ๋Ÿฐ๋ฐ ์ด ์ˆ˜์ •์œผ๋กœ Name.from()์€ ๋‹จ์ˆœํžˆ new Name()์„ ๊ฐ์‹ธ๊ธฐ๋งŒ ํ•˜๊ฒŒ ๋˜์—ˆ๋Š”๋ฐ, ์œ„์—์„œ ๊ตฌ๊ตฌ๊ฐ€ ๋‚จ๊ธด ํŒฉํ„ฐ๋ฆฌ ๋ฉ”์„œ๋“œ ๊ด€๋ จ ์ฝ”๋ฉ˜ํŠธ์™€ ๊ฐ™์€ ๊ณ ๋ฏผ์„ Name์—์„œ๋„ ๋™์ผํ•˜๊ฒŒ ํ•ด๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”!

#1137 (comment)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

record์˜ ๊ธฐ๋ณธ์ƒ์„ฑ์ž ๋ฐฉ์‹์— ๋Œ€ํ•ด์„œ๋Š” ์ƒˆ๋กœ ์•Œ์•˜์Šต๋‹ˆ๋‹ค!

์‚ฌ์‹ค Name.from์„ ์ œ๊ฑฐํ•˜๋ ค ํ–ˆ์œผ๋‚˜ ํ…Œ์ŠคํŠธ ๋ฉ”์„œ๋“œ์—์„œ ๋งŽ์ด ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์–ด์„œ new Name()์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์ด ๋ฒˆ๊ฑฐ๋กœ์›Œ ๋ณด๋ฅ˜ํ•œ ์ƒํƒœ์˜€์Šต๋‹ˆ๋‹ค.

๋‹ค๋งŒ ๋‹ค์‹œ ๋ฐฉ๋ฒ•์„ ์ฐพ์•„๋ณด๋‹ˆ ์ธํ…”๋ฆฌ์ œ์ด์— ๋ณ€๊ฒฝํ•ด์ฃผ๋Š” ๊ธฐ๋Šฅ์ด ์กด์žฌํ•˜๋Š” ๊ฒƒ์„ ์•Œ๊ฒŒ๋˜์–ด, ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ๋ฅผ ์ œ๊ฑฐํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Comment on lines +40 to +43
for (int i = 0; i < count; i++) {
drawnCards.add(cards.getLast());
cards.removeLast();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

count๊ฐ€ 60์ด ๋„˜์–ด๊ฐ€๋Š” ๋“ฑ count๊ฐ€ ๋น„์ •์ƒ์ ์œผ๋กœ ์ปค์ง€๋ฉด ์—ฌ๊ธฐ์—์„œ๋Š” ์–ด๋–ค ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ• ๊นŒ์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ง์”€ํ•˜์‹  ์ƒํ™ฉ์ฒ˜๋Ÿผ Deck์— ๋‚จ์€ ์นด๋“œ๋ณด๋‹ค ๋งŽ์€ ์ˆ˜์˜ ์นด๋“œ๋ฅผ ์š”์ฒญํ•  ๊ฒฝ์šฐ, ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉฐ ๋น„์ •์ƒ์ ์ธ ์ข…๋ฃŒ๊ฐ€ ๋  ์œ„ํ—˜์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ์นด๋“œ๋ฅผ ์‹ค์ œ๋กœ ๋ฝ‘๊ธฐ ์ „ ์ˆ˜๋Ÿ‰์ด ์ถฉ๋ถ„ํ•œ์ง€ ๊ฒ€์ฆํ•˜๋Š” ๊ณผ์ •(ValidateCardsCount)๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์Šต๋‹ˆ๋‹ค! ๋ฐฉ์–ด ์ฝ”๋“œ๋ฅผ ์ž˜ ์ถ”๊ฐ€ํ•ด์ฃผ์…จ๋„ค์š” ๐Ÿ‘

ํ•œ ๊ฐ€์ง€ ๋” ์ด์•ผ๊ธฐํ•ด๋ณด์ž๋ฉด ์˜ˆ์™ธ ๋ฉ”์‹œ์ง€๊ฐ€ ๋น„์–ด์žˆ๋Š” ๋ถ€๋ถ„์„ ํ•œ๋ฒˆ ๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”

    private void validateCardsCount(int drawCount) {
        if (cards.size() < drawCount) {
            throw new IllegalArgumentException(); // ์˜ˆ์™ธ๋ฉ”์‹œ์ง€๊ฐ€ ๋น„์–ด์žˆ์Œ.
        }

์—๋Ÿฌ๊ฐ€ ๋‚ฌ์„ ๋•Œ ๋””๋ฒ„๊น…์„ ์†์‰ฝ๊ฒŒํ•˜๋ ค๋ฉด ์—๋Ÿฌ์— ์˜๋ฏธ ์žˆ๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ๋‹ด์•„์ฃผ๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค!
์˜ˆ๋ฅผ ๋“ค์–ด ์š”์ฒญํ•œ ์นด๋“œ ์ˆ˜์™€ ๋‚จ์€ ์นด๋“œ ์ˆ˜๋ฅผ ๋ฉ”์‹œ์ง€์— ํฌํ•จํ•˜๋ฉด ๋ฌธ์ œ ์›์ธ์„ ๋” ๋น ๋ฅด๊ฒŒ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿ‘

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ถ”๊ฐ€๋กœ ์นด๋“œ๋ฅผ ์ œ๊ฑฐํ•˜๋Š” ๋กœ์ง์€ ์ด๋ฏธ ์žˆ๋Š” draw ๋ฉ”์„œ๋“œ๋ฅผ ํ™œ์šฉํ•ด๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š” :)

    public List<Card> draw(int count) {
        validateCardsCount(count);
        List<Card> drawnCards = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            drawnCards.add(draw());
        }
        return List.copyOf(drawnCards);
    }

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์˜ˆ์™ธ ๋ฉ”์„ธ์ง€๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  darw()๋ฅผ ์žฌ์‚ฌ์šฉํ•˜๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

@@ -11,6 +12,10 @@ public class Players implements Iterable<Player> {
private static final int MAX_PLAYER_COUNT = 7;
private final List<Player> players;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Player๊ฐ€ ๋ฐฐํŒ… ๊ธˆ์•ก์„ ์ง์ ‘ ๊ฐ€์ง€๋Š” ๊ฒƒ๋ณด๋‹ค, BettingTable์ด๋‚˜ PlayerBet ๊ฐ™์€ ๋ณ„๋„ ๊ฐ์ฒด๊ฐ€ ๊ด€๋ฆฌํ•˜๋Š” ์ชฝ์ด ๋” ์ข‹์€๊ฑธ๊นŒ์š”?
PlayerBet์ด Player ์ž์ฒด๋ฅผ ๋“ค๊ธฐ๋ณด๋‹ค Name๊ณผ BettingAmount๋งŒ ๊ฐ€์ง€๋„๋ก ๋ถ„๋ฆฌํ•˜๋Š” ๋ฐฉํ–ฅ์€ ์ ์ ˆํ•œ์ง€๋„ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.

๊ฐ๊ฐ์˜ ์ƒํ™ฉ๋งˆ๋‹ค ์žฅ๋‹จ์ ์ด ์žˆ์–ด๋ณด์ด๋„ค์š”~!
์ •๋ฆฌํ•ด์„œ ์ด์•ผ๊ธฐํ•ด๋ณด๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ด์•ผ๊ธฐํ•ด๋ณผ ์ˆ˜ ์žˆ๊ณ˜๊ตฐ์š”

  • Player๊ฐ€ ๋ฐฐํŒ… ๊ธˆ์•ก์„ ์ง์ ‘ ๊ฐ€์ง€๊ธฐ vs ๋ถ„๋ฆฌํ•˜๊ธฐ

    • ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๊ฐ€์ง„๋‹ค๋ฉด? ์ง๊ด€์„ฑ๊ณผ ๋‹จ์ˆœํ•จ์„ ์ฑ™๊ธธ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™๋„ค์š”
    • ๋ถ„๋ฆฌํ•œ๋‹ค๋ฉด? ๋‹จ์ผ ์ฑ…์ž„ ์›์น™(SRP)์„ ์ง€ํ‚ค๋Š” ์‹œ๋„๋ฅผ ํ•ด๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”
  • PlayerBet์ด Player ์ฐธ์กฐ vs Name ์ฐธ์กฐ

    • ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์ฐธ์กฐํ•˜๋ฉด? ์ตœ์ข… ๊ฒฐ์‚ฐ ๋•Œ ๊ฒฐ๊ณผ์™€ ๋ฐฐํŒ… ๊ธˆ์•ก์„ ์กฐํ•ฉํ•˜๊ธฐ ์ˆ˜์›”ํ•˜๊ฒ ๋„ค์š”!
    • ์ด๋ฆ„์„ ์ฐธ์กฐํ•˜๋ฉด? ๊ฐ์ฒด์˜ ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถœ ์ˆ˜ ์žˆ๊ฒ ๋„ค์š”

์ด๋ฒˆ ๋ฏธ์…˜์—์„œ ๊ด€๋ฆฌํ•ด์•ผ ํ•  ์ƒํƒœ์˜ ๋ณต์žก๋„๋ฅผ ๊ณ ๋ คํ•ด ๋ณด๊ณ , ๋‚˜๋ฌด๊ฐ€ ์ƒ๊ฐํ–ˆ์„ ๋•Œ๋Š” ์–ด๋–ค ๋ฐฉ๋ฒ•์ด ๋” ํƒ€๋‹นํ• ๊ฒƒ ๊ฐ™์€์ง€ ์ด์•ผ๊ธฐ๋ฅผ ๋“ค๋ ค์ฃผ์„ธ์š”!

์œ„์˜ ์ œ ์˜๊ฒฌ์€ ๋‹จ์ˆœ ์ฐธ๊ณ ์šฉ์ผ๋ฟ์ด๋‹ˆ ๋‚˜๋ฌด์˜ ์ƒ๊ฐ๊ณผ ๊ทผ๊ฑฐ๋ฅผ ๋ง๋ถ™์—ฌ์„œ ์•„๋ž˜ ์ฝ”๋ฉ˜ํŠธ๋ฅผ ๋‚จ๊ฒจ์ฃผ์„ธ์š”

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Player๊ฐ€ ๋ฐฐํŒ… ๊ธˆ์•ก์„ ์ง์ ‘ ๊ฐ€์ง€๊ธฐ vs ๋ถ„๋ฆฌํ•˜๊ธฐ
    ์ €๋Š” ๋ฐฐํŒ… ๊ธˆ์•ก์„ Player์— ์ง์ ‘ ํฌํ•จํ•˜๊ธฐ๋ณด๋‹ค ๋ถ„๋ฆฌํ•˜๋Š” ์ชฝ์ด ๋” ํƒ€๋‹นํ•˜๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค
    ๋ฐฐํŒ… ๊ธˆ์•ก์€ ํ”Œ๋ ˆ์ด์–ด ์ž์ฒด์˜ ์ฑ…์ž„์ด๋ผ๊ธฐ๋ณด๋‹ค, ํ”Œ๋ ˆ์ด์–ด์™€ ์—ฐ๊ด€๋œ ๋ณ„๋„์˜ ์ •๋ณด๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค. ๋ถ„๋ฆฌํ•˜๋ฉด ๊ฒŒ์ž„์„ ๋‹ค์‹œ ์ง„ํ–‰ํ•˜๊ฑฐ๋‚˜ ๋ฐฐํŒ… ๊ด€๋ จ ๊ทœ์น™์ด ๋ณ€๊ฒฝ๋˜๋Š” ๊ฒฝ์šฐ์—๋„ Player๋Š” ์œ ์ง€ํ•œ ์ฑ„ ๋ฐฐํŒ… ์ •๋ณด๋งŒ ์ƒˆ๋กœ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์–ด ๋” ๋Œ€์‘ํ•˜๊ธฐ ๋” ์ข‹์„ ๊ฒƒ์ด๋ผ ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.

  • PlayerBet์ด Player ์ฐธ์กฐ vs Name ์ฐธ์กฐ
    PlayerBet์ด ํ•„์š”ํ•œ ์ •๋ณด๋Š” Player ์ „์ฒด๊ฐ€ ์•„๋‹ˆ๋ผ Player๋ฅผ ์‹๋ณ„ํ•  ์ˆ˜ ์žˆ๋Š” ์ตœ์†Œํ•œ์˜ ์ •๋ณด์™€ ๋ฐฐํŒ… ๊ธˆ์•ก์ด๋ผ๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ Player๋ฅผ ์ง์ ‘ ์ฐธ์กฐํ•˜๊ธฐ๋ณด๋‹ค Name์„ ์ฐธ์กฐํ•˜๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค. Player๋ฅผ ์ฐธ์กฐํ•˜๊ณ  ์žˆ์œผ๋ฉด Player์˜ ๋ฐฐํŒ…๊ณผ ๋ฌด๊ด€ํ•œ ๋‹ค๋ฅธ ์ƒํƒœ๋‚˜ ํ–‰์œ„์—๋„ ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•ด์ ธ ๊ฒฐํ•ฉ๋„๊ฐ€ ๋†’์•„์งˆ ์ˆ˜ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.
    String๊ณผ Name์‚ฌ์ด์—์„œ๋„ ๊ณ ๋ฏผ์„ ํ–ˆ์—ˆ๋Š”๋ฐ, ์ด๋ฏธ ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์‹๋ณ„ํ•˜๋Š” Name์ด ์กด์žฌํ•˜๋ฏ€๋กœ PlayerBet์—์„œ๋„ Name์„ ์‚ฌ์šฉํ•˜๋Š” ํŽธ์ด ์ผ๊ด€์„ฑ์„ ์œ ์ง€ํ•˜๋Š” ๋ฐ ๋” ์ ์ ˆํ•˜๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฐ ์„ ํƒ์ง€์— ๋Œ€ํ•œ ๊ทผ๊ฑฐ๋ฅผ ๋ช…ํ™•ํ•˜๊ฒŒ ์ •๋ฆฌํ•ด์ฃผ์…จ๋„ค์š”

๋‚˜๋ฌด๊ฐ€ ์„ ํƒํ•ด์ฃผ์‹  ๊ทผ๊ฑฐ์— ์ถฉ๋ถ„ํžˆ ๋‚ฉ๋“์ด๊ฐ‘๋‹ˆ๋‹ค ๐Ÿ‘
๊ฒŒ์ž„์„ ๋‹ค์‹œ ์ง„ํ–‰ํ•˜๊ฑฐ๋‚˜ ๋ฐฐํŒ… ๊ด€๋ จ ๊ทœ์น™์ด ๋ณ€๊ฒฝ๋˜๋Š” ๊ฒฝ์šฐ์—๋„ Player๋Š” ์œ ์ง€ํ•œ ์ฑ„ ๋ฐฐํŒ… ์ •๋ณด๋งŒ ์ƒˆ๋กœ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์–ด
์œ„ ๋ถ€๋ถ„์ด ์ข‹์€ ๊ทผ๊ฑฐ๋กœ ๋‹ค๊ฐ€์™”๋‹ค๊ณ  ์ƒ๊ฐํ•ด์š”

์•„๋ž˜ PlayerBet์ด Player ์ฐธ์กฐ vs Name ์ฐธ์กฐ ๋ถ€๋ถ„์—์„œ ํ•œ๊ฐ€์ง€๋งŒ ์ƒ๊ฐํ•ด๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์€๊ฒŒ ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์‹๋ณ„ํ•˜๋Š” Name์ด ์กด์žฌํ•œ๋‹ค๊ณ  ๋ง์”€ํ•ด์ฃผ์…จ๋Š”๋ฐ ๋™๋ช…์ด์ธ์˜ ๊ฒฝ์šฐ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌ๋ ๊นŒ์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ˜„์žฌ๋Š” Players์˜ ์ƒ์„ฑ ๊ณผ์ •์—์„œ ์ค‘๋ณต ์ด๋ฆ„์„ ํ—ˆ์šฉํ•˜์ง€ ์•Š๊ณ  ์žˆ๊ณ , Participant์˜ ๋™๋“ฑ์„ฑ๋„ Name ๊ธฐ์ค€์œผ๋กœ ํŒ๋‹จํ•˜๊ณ  ์žˆ์–ด์„œ Name์ด ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์‹๋ณ„ํ•˜๋Š” ์—ญํ• ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ PlayerBet์ด Player ์ „์ฒด ๋Œ€์‹  Name๊ณผ BettingAmount๋งŒ ๊ฐ€์ง€๋Š” ๋ฐฉํ–ฅ์ด ๊ฐ€๋Šฅํ•˜๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ์–ธ๊ธ‰ํ•˜์‹  ๋ถ€๋ถ„์„ ๋ณด๊ณ  ์ƒ๊ฐํ•ด๋ณด๋‹ˆ, Name์„ ์‹๋ณ„์ž๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š”๊ฐ€?๋Š” ๊ฒฐ๊ตญ ์ด๋ฆ„์˜ ์ค‘๋ณต์„ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•  ์ง€์— ๋‹ฌ๋ ค ์žˆ๋‹ค๊ณ  ์ƒ๊ฐ์ด ๋์Šต๋‹ˆ๋‹ค.

๋งŒ์•ฝ ์š”๊ตฌ์‚ฌํ•ญ์ด ๋ฐ”๋€Œ์–ด ๋™๋ช…์ด์ธ์„ ํ—ˆ์šฉํ•˜๊ฒŒ ๋œ๋‹ค๋ฉด Name๋งŒ์œผ๋กœ๋Š” ์‹๋ณ„์ด ์–ด๋ ค์›Œ์ง€๋ฏ€๋กœ, PlayerId ๊ฐ™์€ ๋ณ„๋„์˜ ์‹๋ณ„์ž๊ฐ€ ํ•„์š”ํ•ด์งˆ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Comment thread README.md
Comment thread README.md
- [x] ์•ˆ๋‚ด ๋ฉ”์„ธ์ง€ ์ถœ๋ ฅ ํ›„ ์ฐธ์—ฌํ•  ํ”Œ๋ ˆ์ด์–ด ์ด๋ฆ„๋“ค์„ ์ž…๋ ฅ์„ ๋ฐ›๋Š”๋‹ค
- [x] ๋„๊ฐ’์ด๋‚˜ ๋นˆ ๊ณต๋ฐฑ ์˜ˆ์™ธ์ฒ˜๋ฆฌ
- [x] ์‰ผํ‘œ ๊ธฐ์ค€์œผ๋กœ ์ž…๋ ฅ ๋ถ„๋ฆฌ
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ณ ๋ฏผ์ด ์–•์œผ๋ฉด ์งˆ๋ฌธ์ด ๋„ˆ๋ฌด ๊ฐ€๋ณ๊ณ , ๊ณ ๋ฏผ์ด ๊นŠ์œผ๋ฉด ์˜คํžˆ๋ ค ๊ผฌ๋ฆฌ ์งˆ๋ฌธ์ด ๊ณ„์† ์ƒ๊ฒจ ์ดˆ๊ธฐ ์˜๋ฌธ์˜ ๋ฐฉํ–ฅ์„ ์žƒ์–ด๋ฒ„๋ฆฌ๊ณค ํ–ˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์‹ค ์ด ๋ฌธ์ œ ๋•Œ๋ฌธ์— ๋”์šฑ ์ •์‹ ์—†๋Š” ๋ฏธ์…˜ ์ง„ํ–‰์ด ๋˜์—ˆ๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์Ÿ์•„์ง€๋Š” ์ƒˆ๋กœ์šด ๊ฐœ๋…๊ณผ ์ƒˆ๋กญ๊ฒŒ ๋ณด์ด๋Š” ๋ฌธ์ œ์ ๋“ค์„ ๊ฐ๋‹นํ•˜๊ธฐ ์–ด๋ ค์› ๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
์ฃผ๋…ธ๋Š” ์ด๋Ÿฐ ์ƒํ™ฉ์—์„œ ์งˆ๋ฌธ์˜ ์ ์ ˆํ•œ ๊นŠ์ด์™€ ํƒ€์ด๋ฐ์„ ์žก๋Š” ๊ธฐ์ค€์œผ๋กœ ์žˆ๋Š” ์ง€ ์—ฌ์ญค๋ณด๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.

์ด์ „ ๋ฏธ์…˜์—์„œ ์ œ๊ฐ€ ๋„ˆ๋ฌด ๋งŽ์€ ์งˆ๋ฌธ์„ ๋“œ๋ ธ๋˜๊ฑฐ๊ฐ™๋„ค์š” ๐Ÿ˜…

์งˆ๋ฌธ์˜ ํƒ€์ด๋ฐ์— ๋Œ€ํ•œ ์ œ ๊ธฐ์ค€์„ ๋ง์”€๋“œ๋ฆฌ๋ฉด, ๋‚ด๊ฐ€ ์ดํ•ดํ•œ ๊ฒƒ, ์‹œ๋„ํ•ด ๋ณธ ๊ฒƒ, ๋ง‰ํžŒ ์ง€์ ์ด ์Šค์Šค๋กœ ๋ช…ํ™•ํ•ด์กŒ์„ ๋•Œ๊ฐ€ ๊ฐ€์žฅ ์ข‹์€ ํƒ€์ด๋ฐ์ด๋ผ๊ณ  ์ƒ๊ฐํ•ด์š”. ใ…Žใ…Ž

์ง€๊ธˆ์˜ ์งˆ๋ฌธ์œผ๋กœ๋Š” ๋‚˜๋ฌด๊ฐ€ ๊ตฌ์ฒด์ ์œผ๋กœ ์–ธ์ œ, ์–ด๋–ค ์–ด๋ ค์›€์„ ๊ฒช์œผ์…จ๋Š”์ง€ ํŒŒ์•…ํ•˜๊ธฐ๊ฐ€ ์กฐ๊ธˆ ์–ด๋ ต๋„ค์š” ๐Ÿฅน
์ด๋ฒˆ์— ๊ฒช์œผ์…จ๋˜ ์–ด๋ ค์›€ ์ค‘ ํ•˜๋‚˜๋ฅผ ๊ณจ๋ผ ์œ„ ์„ธ ๊ฐ€์ง€ ๊ธฐ์ค€์œผ๋กœ ์ •๋ฆฌํ•ด์„œ ๋‹ค์‹œ ๋“ค๋ ค์ฃผ์‹œ๋ฉด ๋” ์ข‹์€ ๋ฐฉํ–ฅ์„ ํ•จ๊ป˜ ๊ณ ๋ฏผํ•ด ๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”!

Comment thread src/main/java/domain/Command.java
Comment thread src/main/java/domain/DeckShuffler.java
Copy link
Copy Markdown
Author

@symflee symflee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฆฌ๋ทฐ ํ•ด์ฃผ์‹  ๋ถ€๋ถ„๋“ค ๋ฐ˜์˜ํ•˜์—ฌ ์ผ๋ถ€ ์ˆ˜์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
์ด๋ฒˆ์—๋„ ์ž˜ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

Comment thread src/main/java/Game.java
Comment on lines +55 to 60
private void readyPhase(Participants participants) {
gameManager.dealInitialCards(participants);

InitialDealingResult initialDealingResult = InitialDealingResult.from(participants);
outputView.printInitialDealingResult(initialDealingResult);
}
Copy link
Copy Markdown
Author

@symflee symflee Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ธฐ์กด์—๋Š” ์ดˆ๊ธฐ ์นด๋“œ ์ง€๊ธ‰๊ณผ ์ถœ๋ ฅ์šฉ ๋ฐ์ดํ„ฐ ์กฐ๋ฆฝ์„ ํ•˜๋‚˜์˜ ํด๋ž˜์Šค๊ฐ€ ๋‹ด๋‹นํ•˜๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์ดˆ๊ธฐ ์นด๋“œ ์ง€๊ธ‰์€ GameManager๊ฐ€, ์ถœ๋ ฅ์šฉ ๋ฐ์ดํ„ฐ ์ƒ์„ฑ์€ ๋ณ„๋„์˜ ๊ฐ์ฒด๊ฐ€ ๋‹ด๋‹นํ•˜๋„๋ก ๋ถ„๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ทธ ๊ฒฐ๊ณผ ๊ฒŒ์ž„ ํ๋ฆ„ ์ œ์–ด์— ๋” ์ง‘์ค‘ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๊ณ , ์ดˆ๊ธฐ ์นด๋“œ ์ง€๊ธ‰ ๊ทœ์น™๋„ ํ•œ ๊ณณ์— ๋ชจ์—ฌ ์‘์ง‘๋„๊ฐ€ ๋†’์•„์กŒ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ dealInitialCards(participants)์ฒ˜๋Ÿผ ๊ฐ€๋…์„ฑ๋„ ์ข‹์•„์กŒ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

@@ -11,6 +12,10 @@ public class Players implements Iterable<Player> {
private static final int MAX_PLAYER_COUNT = 7;
private final List<Player> players;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Player๊ฐ€ ๋ฐฐํŒ… ๊ธˆ์•ก์„ ์ง์ ‘ ๊ฐ€์ง€๊ธฐ vs ๋ถ„๋ฆฌํ•˜๊ธฐ
    ์ €๋Š” ๋ฐฐํŒ… ๊ธˆ์•ก์„ Player์— ์ง์ ‘ ํฌํ•จํ•˜๊ธฐ๋ณด๋‹ค ๋ถ„๋ฆฌํ•˜๋Š” ์ชฝ์ด ๋” ํƒ€๋‹นํ•˜๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค
    ๋ฐฐํŒ… ๊ธˆ์•ก์€ ํ”Œ๋ ˆ์ด์–ด ์ž์ฒด์˜ ์ฑ…์ž„์ด๋ผ๊ธฐ๋ณด๋‹ค, ํ”Œ๋ ˆ์ด์–ด์™€ ์—ฐ๊ด€๋œ ๋ณ„๋„์˜ ์ •๋ณด๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค. ๋ถ„๋ฆฌํ•˜๋ฉด ๊ฒŒ์ž„์„ ๋‹ค์‹œ ์ง„ํ–‰ํ•˜๊ฑฐ๋‚˜ ๋ฐฐํŒ… ๊ด€๋ จ ๊ทœ์น™์ด ๋ณ€๊ฒฝ๋˜๋Š” ๊ฒฝ์šฐ์—๋„ Player๋Š” ์œ ์ง€ํ•œ ์ฑ„ ๋ฐฐํŒ… ์ •๋ณด๋งŒ ์ƒˆ๋กœ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์–ด ๋” ๋Œ€์‘ํ•˜๊ธฐ ๋” ์ข‹์„ ๊ฒƒ์ด๋ผ ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.

  • PlayerBet์ด Player ์ฐธ์กฐ vs Name ์ฐธ์กฐ
    PlayerBet์ด ํ•„์š”ํ•œ ์ •๋ณด๋Š” Player ์ „์ฒด๊ฐ€ ์•„๋‹ˆ๋ผ Player๋ฅผ ์‹๋ณ„ํ•  ์ˆ˜ ์žˆ๋Š” ์ตœ์†Œํ•œ์˜ ์ •๋ณด์™€ ๋ฐฐํŒ… ๊ธˆ์•ก์ด๋ผ๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ Player๋ฅผ ์ง์ ‘ ์ฐธ์กฐํ•˜๊ธฐ๋ณด๋‹ค Name์„ ์ฐธ์กฐํ•˜๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค. Player๋ฅผ ์ฐธ์กฐํ•˜๊ณ  ์žˆ์œผ๋ฉด Player์˜ ๋ฐฐํŒ…๊ณผ ๋ฌด๊ด€ํ•œ ๋‹ค๋ฅธ ์ƒํƒœ๋‚˜ ํ–‰์œ„์—๋„ ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•ด์ ธ ๊ฒฐํ•ฉ๋„๊ฐ€ ๋†’์•„์งˆ ์ˆ˜ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.
    String๊ณผ Name์‚ฌ์ด์—์„œ๋„ ๊ณ ๋ฏผ์„ ํ–ˆ์—ˆ๋Š”๋ฐ, ์ด๋ฏธ ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์‹๋ณ„ํ•˜๋Š” Name์ด ์กด์žฌํ•˜๋ฏ€๋กœ PlayerBet์—์„œ๋„ Name์„ ์‚ฌ์šฉํ•˜๋Š” ํŽธ์ด ์ผ๊ด€์„ฑ์„ ์œ ์ง€ํ•˜๋Š” ๋ฐ ๋” ์ ์ ˆํ•˜๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.

Comment on lines +40 to +43
for (int i = 0; i < count; i++) {
drawnCards.add(cards.getLast());
cards.removeLast();
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ง์”€ํ•˜์‹  ์ƒํ™ฉ์ฒ˜๋Ÿผ Deck์— ๋‚จ์€ ์นด๋“œ๋ณด๋‹ค ๋งŽ์€ ์ˆ˜์˜ ์นด๋“œ๋ฅผ ์š”์ฒญํ•  ๊ฒฝ์šฐ, ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉฐ ๋น„์ •์ƒ์ ์ธ ์ข…๋ฃŒ๊ฐ€ ๋  ์œ„ํ—˜์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ์นด๋“œ๋ฅผ ์‹ค์ œ๋กœ ๋ฝ‘๊ธฐ ์ „ ์ˆ˜๋Ÿ‰์ด ์ถฉ๋ถ„ํ•œ์ง€ ๊ฒ€์ฆํ•˜๋Š” ๊ณผ์ •(ValidateCardsCount)๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.

Comment thread src/main/java/domain/DeckShuffler.java
Comment thread README.md

private void readyPhase(Dealer dealer, Players players) {
gameManager.dealStartingCards(dealer);
gameManager.dealCardTo(players, 2);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋„ต
INITIAL_CARD_COUNT ๋ผ๋Š” ์ด๋ฆ„์„ ๋ถ€์—ฌํ•˜๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

return new BettingTable(bettingTable);
}

public void add(PlayerBetting playerBetting) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฒŒ์ž„์—์„œ ๋ฒ ํŒ…ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ํ‘œํ˜„์ธ 'place a bet'์—์„œ ๋ฉ”์„œ๋“œ๋ช…์„ place๋กœ ์ˆ˜์ •ํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

์™ธ๋ถ€์˜ placeBet์ด๋ผ๋Š” ๋ฉ”์„œ๋“œ ์•ˆ์—์„œ bettingTable.place(playerBet) ํ˜•ํƒœ๋กœ ํ˜ธ์ถœํ•˜๊ฒŒ ๋˜๋Š”๋ฐ ์ด๋Ÿฌํ•œ ๋„ค์ด๋ฐ์ด ์ ์ ˆํ• ๊นŒ์š”?

private static final int HIT_THRESHOLD = 16;

public Dealer() {
super(new Name(DEFAULT_NAME));
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ง์”€ํ•ด ์ฃผ์‹  ๊ฒƒ ์ฒ˜๋Ÿผ ๊ธฐ๋ณธ ์ƒ์„ฑ์ž๋กœ ์ƒ์„ฑํ•  ๊ฒฝ์šฐ ๊ฒ€์ฆ์ด ๋ˆ„๋ฝ๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๊ธฐ๋ณธ ์ƒ์„ฑ์ž์— ๊ฒ€์ฆ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๋„๋ก ํ•˜๊ณ , ์ •์  ๋ฉ”์„œ๋“œ์—์„œ ๊ธฐ๋ณธ ์ƒ์„ฑ์ž๋ฅผ ํ˜ธ์ถœํ•ด ๋ฐ˜ํ™˜ํ•˜๋„๋ก ์ˆ˜์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค.


import java.util.List;

public record ParticipantsProfitResult(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฒŒ์ž„์ด ์ข…๋ฃŒ๋œ ์ดํ›„์— profit์ด ๊ฒฐ์ •๋˜๊ธฐ ๋•Œ๋ฌธ์— profit๋งŒ์œผ๋กœ ๊ฒฐ๊ณผ๋ผ๋Š” ์˜๋ฏธ๋ฅผ ์ถฉ๋ถ„ํžˆ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ์–ด, result๋Š” ๋ถ™์ผ ํ•„์š”๊ฐ€ ์—†๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ์ˆ˜์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Comment thread src/main/java/domain/Deck.java Outdated
Copy link
Copy Markdown
Member

@Choi-JJunho Choi-JJunho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋‚˜๋ฌด~! ๋ฆฌ๋ทฐ ๋ฐ˜์˜ ๋ฐ ์ฝ”๋ฉ˜ํŠธ๋ฅผ ์ž˜ ๋‚จ๊ฒจ์ฃผ์…จ๋„ค์š”!
๋ช‡๊ฐ€์ง€ ํ™•์ธํ•ด๋ณผ๋งŒํ•œ ๋ถ€๋ถ„์ด ์กฐ๊ธˆ ๋‚จ์•„์žˆ์–ด Request changes๋ฅผ ๋‚จ๊น๋‹ˆ๋‹ค!
ํ™”์ดํŒ…์ž…๋‹ˆ๋‹ค ๐Ÿ’ช

Comment on lines +7 to +12
public class RandomDeckShuffler implements DeckShuffler {
@Override
public List<Card> shuffle(List<Card> cards) {
Collections.shuffle(cards);

return cards;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collections.shuffle(cards); ์„ ์ˆ˜ํ–‰ํ•˜๊ณ  ๋ฐ˜ํ™˜ํ•˜๊ณ ์žˆ๋„ค์š”!
cards๊ฐ€ immutable์ด๋ผ๋ฉด ์–ด๋–ค ์ผ์ด ์ผ์–ด๋‚ ๊นŒ์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnsupportedOperationException์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•˜๊ฒŒ๋ฉ๋‹ˆ๋‹ค..!

์ธํ„ฐํŽ˜์ด์Šค DeckShuffler ๋Š” List<Card> shuffle(List<Card> cards)๋กœ ์„ ์–ธ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์‹œ๊ทธ๋‹ˆ์ณ๋ฅผ ๋ณด๋ฉด, ์–ด๋– ํ•œ List<Card>๋“  ๋ฐ›์•„์„œ ๋ฐ˜ํ™˜ํ•ด์ค„ ๊ฒƒ์œผ๋กœ ๊ธฐ๋Œ€๋ฉ๋‹ˆ๋‹ค.
๊ทธ๋Ÿฌ๋‚˜ ์‹ค์ œ๋กœ๋Š” โ€˜์ „๋‹ฌ๋ฐ›์€ ๋ฆฌ์ŠคํŠธ๋ฅผ ์ง์ ‘ ๋ณ€๊ฒฝํ•˜๊ธฐ์— mutable์„ ์š”๊ตฌํ•˜๋Š”โ€™ Collections.shuffle()๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
์ฆ‰, ๊ธฐ๋Œ€๋˜๋Š” ๋™์ž‘๊ณผ ์‹ค์ œ ๋™์ž‘์˜ ๊ฐ„๊ทน์ด ์กด์žฌํ•˜๋Š” ์ƒํ™ฉ์ด์—ˆ์Šต๋‹ˆ๋‹ค.

์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ ๊ตฌํ˜„์ฒด RandomDeckShuffler.shuffle(List<Card>)์€ ์ด์ „์ฒ˜๋Ÿผ ์ „๋‹ฌ๋ฐ›์€ ๋ฆฌ์ŠคํŠธ์˜ ๋ณต์‚ฌ๋ณธ์„ ๋งŒ๋“ค์–ด Collections.shuffle()์—๊ฒŒ ์ „๋‹ฌํ•˜๋„๋ก ๋˜๋Œ๋ ธ์Šต๋‹ˆ๋‹ค.

๋‹ค๋งŒ, ๋˜๋Œ๋ฆฌ๊ฒŒ๋˜๋ฉด ๋ณต์‚ฌ ์ฑ…์ž„์ด ๋ถˆ๋ถ„๋ช…ํ•˜๊ณ  ์ค‘๋ณต์œผ๋กœ ์ˆ˜ํ–‰๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ๋‹ค์‹œ ์ƒ๊ธฐ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ, Deck์ด ์ž์‹ ์˜ ๋ฆฌ์ŠคํŠธ์˜ ๋ณต์‚ฌ๋ณธ์„ ๋งŒ๋“ค์–ด ์ „๋‹ฌํ•˜๋˜ ๊ฒƒ์„, ๋ณต์‚ฌ ๋น„์šฉ์ด ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š” unmodifiableList๋ฅผ ์ด์šฉํ•ด ์ฝ๊ธฐ์ „์šฉ ๋ทฐ๋ฅผ ๋„˜๊ธฐ๋„๋ก ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

์ด๋ฅผํ†ตํ•ด ์ด์ค‘ ๋ณต์‚ฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋ฉด์„œ, Deck์ด ์ž์‹ ์˜ cards๋ฅผ ์™ธ๋ถ€์—์„œ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•œ ์ƒํƒœ๋กœ ๋„˜๊ธฐ์ง€ ์•Š๋„๋ก ์ˆ˜์ •ํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.

์ฆ‰, ์ด์ „ ์ˆ˜์ •์—์„œ unmodifiableList๋ฅผ ์‚ฌ์šฉํ–ˆ์œผ๋ฉด ํ•œ ๋ฒˆ์— ํ•ด๊ฒฐ๋  ๋ฌธ์ œ์˜€์Šต๋‹ˆ๋‹ค.

์ œ๊ฐ€ ์ดํ•ดํ•˜๊ณ  ์ˆ˜์ •ํ•œ ๊ฒƒ์ด ์˜๋„ํ•˜์‹  ๋ฐฉํ–ฅ์ด ๋งž์„๊นŒ์š”?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋„ค~! ์˜๋„ํ•œ๋Œ€๋กœ ์ž˜ ์ˆ˜์ •ํ•ด์ฃผ์…จ์–ด์š” ๐Ÿ‘
์ •๋ฆฌํ•ด๋ณด์ž๋ฉด ์ œ๊ฐ€ ๋“œ๋ ธ๋˜ ๋ฆฌ๋ทฐ์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์˜๋„๊ฐ€ ์žˆ์—ˆ๋‹ค๊ณ  ์ดํ•ดํ•ด์ฃผ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”

  • Deck โ†’ unmodifiableList๋กœ ์ฝ๊ธฐ ์ „์šฉ ๋ทฐ๋ฅผ ์ „๋‹ฌ (๋‚ด๋ถ€ ์ƒํƒœ ๋ณดํ˜ธ, ๋ถˆํ•„์š”ํ•œ ๋ณต์‚ฌ ์ œ๊ฑฐ)
  • RandomDeckShuffler โ†’ ์ „๋‹ฌ๋ฐ›์€ ๋ฆฌ์ŠคํŠธ์˜ ๋ณต์‚ฌ๋ณธ์„ ๋งŒ๋“ค์–ด shuffle (์–ด๋–ค List๋“  ์•ˆ์ „ํ•˜๊ฒŒ ์ฒ˜๋ฆฌ)

unmodifiableList๋กœ ์ด์ค‘ ๋ณต์‚ฌ ๋ฌธ์ œ๊นŒ์ง€ ์ž˜ ํ•ด๊ฒฐํ•ด์ฃผ์…จ๋„ค์š”๐Ÿ‘

Comment thread src/main/java/Game.java
Comment on lines +55 to 60
private void readyPhase(Participants participants) {
gameManager.dealInitialCards(participants);

InitialDealingResult initialDealingResult = InitialDealingResult.from(participants);
outputView.printInitialDealingResult(initialDealingResult);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์Šต๋‹ˆ๋‹ค~! ๋ถ„๋ฆฌํ•œ ์ด์œ ์™€ ๊ทธ์— ๋”ฐ๋ฅธ ์ด์ ์„ ์ž˜ ์„ค๋ช…ํ•ด์ฃผ์…จ๋„ค์š”!
๋‚˜๋ฌด๊ฐ€ ์ด์•ผ๊ธฐํ•ด์ฃผ์‹  dealInitialCards(participants) ํ˜•ํƒœ๋กœ ๊ฐ€๋…์„ฑ์ด ์ข‹์•„์ง„ ๋ถ€๋ถ„๋„ ๋™์˜ํ•ฉ๋‹ˆ๋‹ค. ๐Ÿ‘

๋‹ค๋ฅธ ํฌ๋ฃจ๋“ค๊ณผ๋„ ์ด์•ผ๊ธฐ๋ฅผ ๋‚˜๋ˆ ๋ณด๋ฉด์„œ ๋‚˜๋ฌด๊ฐ€ ์ƒ๊ฐํ•˜๋Š” ํƒ€๋‹นํ•œ ์˜๊ฒฌ์„ ๊ฒฌ๊ณ ํžˆ ๋‹ค์ ธ๊ฐ€๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค ๐Ÿ’ช

private static final int HIT_THRESHOLD = 16;

public Dealer() {
super(new Name(DEFAULT_NAME));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์Šต๋‹ˆ๋‹ค~ record์—์„œ๋Š” ๊ธฐ๋ณธ์ƒ์„ฑ์ž์— ๋Œ€ํ•œ ๊ฒ€์ฆ์„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค

    public Name {
        validate(value);
    }

๊ทธ๋Ÿฐ๋ฐ ์ด ์ˆ˜์ •์œผ๋กœ Name.from()์€ ๋‹จ์ˆœํžˆ new Name()์„ ๊ฐ์‹ธ๊ธฐ๋งŒ ํ•˜๊ฒŒ ๋˜์—ˆ๋Š”๋ฐ, ์œ„์—์„œ ๊ตฌ๊ตฌ๊ฐ€ ๋‚จ๊ธด ํŒฉํ„ฐ๋ฆฌ ๋ฉ”์„œ๋“œ ๊ด€๋ จ ์ฝ”๋ฉ˜ํŠธ์™€ ๊ฐ™์€ ๊ณ ๋ฏผ์„ Name์—์„œ๋„ ๋™์ผํ•˜๊ฒŒ ํ•ด๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”!

#1137 (comment)

Comment on lines +40 to +43
for (int i = 0; i < count; i++) {
drawnCards.add(cards.getLast());
cards.removeLast();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์Šต๋‹ˆ๋‹ค! ๋ฐฉ์–ด ์ฝ”๋“œ๋ฅผ ์ž˜ ์ถ”๊ฐ€ํ•ด์ฃผ์…จ๋„ค์š” ๐Ÿ‘

ํ•œ ๊ฐ€์ง€ ๋” ์ด์•ผ๊ธฐํ•ด๋ณด์ž๋ฉด ์˜ˆ์™ธ ๋ฉ”์‹œ์ง€๊ฐ€ ๋น„์–ด์žˆ๋Š” ๋ถ€๋ถ„์„ ํ•œ๋ฒˆ ๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”

    private void validateCardsCount(int drawCount) {
        if (cards.size() < drawCount) {
            throw new IllegalArgumentException(); // ์˜ˆ์™ธ๋ฉ”์‹œ์ง€๊ฐ€ ๋น„์–ด์žˆ์Œ.
        }

์—๋Ÿฌ๊ฐ€ ๋‚ฌ์„ ๋•Œ ๋””๋ฒ„๊น…์„ ์†์‰ฝ๊ฒŒํ•˜๋ ค๋ฉด ์—๋Ÿฌ์— ์˜๋ฏธ ์žˆ๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ๋‹ด์•„์ฃผ๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค!
์˜ˆ๋ฅผ ๋“ค์–ด ์š”์ฒญํ•œ ์นด๋“œ ์ˆ˜์™€ ๋‚จ์€ ์นด๋“œ ์ˆ˜๋ฅผ ๋ฉ”์‹œ์ง€์— ํฌํ•จํ•˜๋ฉด ๋ฌธ์ œ ์›์ธ์„ ๋” ๋น ๋ฅด๊ฒŒ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿ‘

@@ -11,6 +12,10 @@ public class Players implements Iterable<Player> {
private static final int MAX_PLAYER_COUNT = 7;
private final List<Player> players;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฐ ์„ ํƒ์ง€์— ๋Œ€ํ•œ ๊ทผ๊ฑฐ๋ฅผ ๋ช…ํ™•ํ•˜๊ฒŒ ์ •๋ฆฌํ•ด์ฃผ์…จ๋„ค์š”

๋‚˜๋ฌด๊ฐ€ ์„ ํƒํ•ด์ฃผ์‹  ๊ทผ๊ฑฐ์— ์ถฉ๋ถ„ํžˆ ๋‚ฉ๋“์ด๊ฐ‘๋‹ˆ๋‹ค ๐Ÿ‘
๊ฒŒ์ž„์„ ๋‹ค์‹œ ์ง„ํ–‰ํ•˜๊ฑฐ๋‚˜ ๋ฐฐํŒ… ๊ด€๋ จ ๊ทœ์น™์ด ๋ณ€๊ฒฝ๋˜๋Š” ๊ฒฝ์šฐ์—๋„ Player๋Š” ์œ ์ง€ํ•œ ์ฑ„ ๋ฐฐํŒ… ์ •๋ณด๋งŒ ์ƒˆ๋กœ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์–ด
์œ„ ๋ถ€๋ถ„์ด ์ข‹์€ ๊ทผ๊ฑฐ๋กœ ๋‹ค๊ฐ€์™”๋‹ค๊ณ  ์ƒ๊ฐํ•ด์š”

์•„๋ž˜ PlayerBet์ด Player ์ฐธ์กฐ vs Name ์ฐธ์กฐ ๋ถ€๋ถ„์—์„œ ํ•œ๊ฐ€์ง€๋งŒ ์ƒ๊ฐํ•ด๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์€๊ฒŒ ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์‹๋ณ„ํ•˜๋Š” Name์ด ์กด์žฌํ•œ๋‹ค๊ณ  ๋ง์”€ํ•ด์ฃผ์…จ๋Š”๋ฐ ๋™๋ช…์ด์ธ์˜ ๊ฒฝ์šฐ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌ๋ ๊นŒ์š”?

Comment thread src/main/java/domain/betting/BettingTable.java
Comment on lines +69 to +75
public String name() {
return name.value();
}

public Name getName() {
return this.name;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name๊ณผ getName์˜ ์ฐจ์ด๋Š” ๋ฌด์—‡์ธ๊ฐ€์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ฒ˜์Œ์—๋Š” ์™ธ๋ถ€(View ๋“ฑ)์—์„œ ๋ฌธ์ž์—ด ์ด๋ฆ„์ด ๋ฐ”๋กœ ํ•„์š”ํ•œ ๊ฒฝ์šฐ ํŽธํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๋ ค๊ณ  name() ๋ฉ”์„œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•ด ๋‘์—ˆ์Šต๋‹ˆ๋‹ค.
์ง€๊ธˆ์€ getName()๊ณผ ๋„ค์ด๋ฐ์ด ๋น„์Šทํ•ด ํ˜ธ์ถœํ•˜๋Š” ์ž…์žฅ์—์„œ ํ˜ผ๋ž€์„ ์ค„ ์ˆ˜ ์žˆ๊ณ , ์›์‹œ๊ฐ’์„ ํฌ์žฅํ•˜๊ณ  ์žˆ๋Š” Name์˜ ์—ญํ• ์„ ํ๋ฆฌ๊ฒŒ ํ•œ๋‹ค๋Š” ๊ฒƒ์„ ๊นจ๋‹ฌ์•˜์Šต๋‹ˆ๋‹ค.
Name์„ ์ „๋‹ฌํ•˜๊ณ  Name์˜ ๋ฐธ๋ฅ˜๋ฅผ ๊บผ๋‚ด๋„๋ก ํ•˜๋Š” ๊ฒƒ์ด ๋” ์ข‹์€ ๋ฐฉํ–ฅ์ผ๊นŒ์š”?

๋‹ค๋งŒ ํ˜„์žฌ ๋ณ€๊ฒฝ ๋ฒ”์œ„๊ฐ€ ์ปค์งˆ ๊ฒƒ ๊ฐ™์•„์„œ, name() ๋ฉ”์„œ๋“œ๋Š” ์‚ญ์ œํ•˜๊ณ , ๋ฌธ์ž์—ด ๊ฐ’์ด ํ•„์š”ํ•œ ๊ณณ์—์„œ๋Š”getName().value()ํ˜•ํƒœ๋กœ Name ๊ฐ์ฒด๋ฅผ ํ†ตํ•ด ์ง์ ‘ ๊บผ๋‚ด ์“ฐ๋„๋ก ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Comment on lines +34 to +42
public List<PlayerMatchResult> playersBettingResult() {
List<PlayerMatchResult> playersBettingResult = new ArrayList<>();

for (Player player : players) {
playersBettingResult.add(PlayerMatchResult.from(dealer, player));
}

return playersBettingResult;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฐฐํŒ… ๊ฒฐ๊ณผ๋ฅผ ๊ณ„์‚ฐํ•˜๋Š” ํ–‰์œ„๋Š” Participants์˜ ์—ญํ• ๋กœ ์ ์ ˆํ•˜๋‹ค๊ณ  ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”?
BettingTable์˜ ์—ญํ• ์€ ๋ฌด์—‡์ธ๊ฐ€์š”?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๋„ค์ธ„๋Ÿด ๋ธ”๋ž™์žญ์ธ์ง€, ์Šน๋ฆฌ์ธ์ง€, ๋ฌด์Šน๋ถ€์ธ์ง€ ๋“ฑ ๊ฒŒ์ž„ ์ข…๋ฃŒ ์‹œ ์นด๋“œ์— ๋”ฐ๋ฅธ ์ŠนํŒจ ๊ฒฐ๊ณผ๋ฅผ BettingResult๋ผ๋Š” ๋„ค์ด๋ฐ์œผ๋กœ ์‚ฌ์šฉํ•ด ํ˜ผ๋™์ด ์žˆ์—ˆ๊ณ  ๊ฐœ์„ ์„ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ํ•˜์ง€ ๋ชปํ•˜์˜€์Šต๋‹ˆ๋‹ค!

Participants๊ฐ€ ๋”œ๋Ÿฌ์™€ ํ”Œ๋ ˆ์ด์–ด๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๊ณ , ๋”œ๋Ÿฌ์™€ ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ํ•ธ๋“œ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋‹ˆ Participants๊ฐ€ ENUM ์ŠนํŒจ ๊ทœ์น™์— ๋”œ๋Ÿฌ์™€ ํ”Œ๋ ˆ์ด์–ด์˜ ์ ์ˆ˜๋ฅผ ๋„˜๊ฒจ ์ŠนํŒจ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ›์•„์˜ค๋Š” ๊ฒƒ์€ ์ ์ ˆํ•˜๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ, ๋„ค์ด๋ฐ๋งŒ ์‹ค์ œ ๊ฒŒ์ž„ ์šฉ์–ด์ธ Showdown์œผ๋กœ ๋‹ค์‹œ ์ˆ˜์ •ํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์Šต๋‹ˆ๋‹ค~! ๋‚˜๋ฌด๊ฐ€ ๋ง์”€ํ•ด์ฃผ์‹  ๊ธฐ์ค€์œผ๋กœ ์ž˜ ๋‚ฉ๋“์ด ๊ฐ€๋„ค์š” ๐Ÿ‘
์ง€๊ธˆ ๊ทœ๋ชจ์—์„œ๋Š” ์ข‹์€ ๊ตฌ์กฐ๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค!

์ง€๊ธˆ ๊ทœ๋ชจ์—์„œ๋Š” ๊ดœ์ฐฎ์ง€๋งŒ ์ŠนํŒจ ํŒ์ • ๊ทœ์น™์ด ๋ณต์žกํ•ด์ง€๋ฉด ์ด ๋กœ์ง์— ๋Œ€ํ•œ ๋ถ„๋ฆฌ๋ฅผ ๊ฒ€ํ† ํ•ด๋ณผ ์ˆ˜ ์žˆ๊ฒ ๋„ค์š” :)

Comment on lines +40 to +43
for (int i = 0; i < count; i++) {
drawnCards.add(cards.getLast());
cards.removeLast();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ถ”๊ฐ€๋กœ ์นด๋“œ๋ฅผ ์ œ๊ฑฐํ•˜๋Š” ๋กœ์ง์€ ์ด๋ฏธ ์žˆ๋Š” draw ๋ฉ”์„œ๋“œ๋ฅผ ํ™œ์šฉํ•ด๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š” :)

    public List<Card> draw(int count) {
        validateCardsCount(count);
        List<Card> drawnCards = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            drawnCards.add(draw());
        }
        return List.copyOf(drawnCards);
    }

Copy link
Copy Markdown
Member

@Choi-JJunho Choi-JJunho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋‚˜๋ฌด~! ๋ธ”๋ž™์žญ ๋ฏธ์…˜ ์™„์ฃผํ•˜์‹œ๋А๋ผ ๋„ˆ๋ฌด ๊ณ ์ƒ ๋งŽ์œผ์…จ์Šต๋‹ˆ๋‹ค! ๐Ÿ‘
์ด๋ฒˆ ๋ฏธ์…˜์„ ํ†ตํ•ด ํ•œ ๋‹จ๊ณ„ ๋” ํฌ๊ฒŒ ์„ฑ์žฅํ•˜์‹  ๋ชจ์Šต์ด ๋‹๋ณด์—ฌ์„œ ๋ฆฌ๋ทฐํ•˜๋Š” ์ €๋„ ๊ฐ™์ด ๋ฐฐ์šธ์ ์ด ๋งŽ์•„์„œ ์ข‹์•˜์Šต๋‹ˆ๋‹ค ๐Ÿ’ช
์กฐ๊ธ‰ํ•ดํ•˜์ง€ ์•Š๊ณ  ์ง€๊ธˆ์ฒ˜๋Ÿผ ๋‚˜๋ฌด๋งŒ์˜ ์†๋„๋กœ ์ฐจ๊ทผ์ฐจ๊ทผ ๋‚˜์•„๊ฐ€๋‹ค ๋ณด๋ฉด ๋น ๋ฅด๊ฒŒ ์„ฑ์žฅํ•ด์žˆ์„๊ฒƒ์ด๋ผ ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค

์š”๊ตฌ์‚ฌํ•ญ๊ณผ ์ฝ”๋ฉ˜ํŠธ ์ž˜ ๋ฐ˜์˜ํ•ด์ฃผ์…”์„œ ์ด๋ฒˆ๋ฏธ์…˜์€ ์—ฌ๊ธฐ์„œ Approve & Merge ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
๋‹ค์Œ ๋ฏธ์…˜๋„ ํ™”์ดํŒ…์ž…๋‹ˆ๋‹ค! ๐Ÿš€

Comment on lines +7 to +12
public class RandomDeckShuffler implements DeckShuffler {
@Override
public List<Card> shuffle(List<Card> cards) {
Collections.shuffle(cards);

return cards;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋„ค~! ์˜๋„ํ•œ๋Œ€๋กœ ์ž˜ ์ˆ˜์ •ํ•ด์ฃผ์…จ์–ด์š” ๐Ÿ‘
์ •๋ฆฌํ•ด๋ณด์ž๋ฉด ์ œ๊ฐ€ ๋“œ๋ ธ๋˜ ๋ฆฌ๋ทฐ์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์˜๋„๊ฐ€ ์žˆ์—ˆ๋‹ค๊ณ  ์ดํ•ดํ•ด์ฃผ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”

  • Deck โ†’ unmodifiableList๋กœ ์ฝ๊ธฐ ์ „์šฉ ๋ทฐ๋ฅผ ์ „๋‹ฌ (๋‚ด๋ถ€ ์ƒํƒœ ๋ณดํ˜ธ, ๋ถˆํ•„์š”ํ•œ ๋ณต์‚ฌ ์ œ๊ฑฐ)
  • RandomDeckShuffler โ†’ ์ „๋‹ฌ๋ฐ›์€ ๋ฆฌ์ŠคํŠธ์˜ ๋ณต์‚ฌ๋ณธ์„ ๋งŒ๋“ค์–ด shuffle (์–ด๋–ค List๋“  ์•ˆ์ „ํ•˜๊ฒŒ ์ฒ˜๋ฆฌ)

unmodifiableList๋กœ ์ด์ค‘ ๋ณต์‚ฌ ๋ฌธ์ œ๊นŒ์ง€ ์ž˜ ํ•ด๊ฒฐํ•ด์ฃผ์…จ๋„ค์š”๐Ÿ‘

Comment on lines +34 to +42
public List<PlayerMatchResult> playersBettingResult() {
List<PlayerMatchResult> playersBettingResult = new ArrayList<>();

for (Player player : players) {
playersBettingResult.add(PlayerMatchResult.from(dealer, player));
}

return playersBettingResult;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์Šต๋‹ˆ๋‹ค~! ๋‚˜๋ฌด๊ฐ€ ๋ง์”€ํ•ด์ฃผ์‹  ๊ธฐ์ค€์œผ๋กœ ์ž˜ ๋‚ฉ๋“์ด ๊ฐ€๋„ค์š” ๐Ÿ‘
์ง€๊ธˆ ๊ทœ๋ชจ์—์„œ๋Š” ์ข‹์€ ๊ตฌ์กฐ๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค!

์ง€๊ธˆ ๊ทœ๋ชจ์—์„œ๋Š” ๊ดœ์ฐฎ์ง€๋งŒ ์ŠนํŒจ ํŒ์ • ๊ทœ์น™์ด ๋ณต์žกํ•ด์ง€๋ฉด ์ด ๋กœ์ง์— ๋Œ€ํ•œ ๋ถ„๋ฆฌ๋ฅผ ๊ฒ€ํ† ํ•ด๋ณผ ์ˆ˜ ์žˆ๊ฒ ๋„ค์š” :)

@Choi-JJunho Choi-JJunho merged commit 76e56ea into woowacourse:symflee Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants