Skip to content

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

Open
khcho96 wants to merge 128 commits intowoowacourse:khcho96from
khcho96:step2

Conversation

@khcho96
Copy link

@khcho96 khcho96 commented Mar 14, 2026

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

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

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

์‚ฌ์ดํด1 ๋งˆ์ง€๋ง‰ ์ฝ”๋ฉ˜ํŠธ์—์„œ ๋ฐ˜์˜ํ•œ ๋‚ด์šฉ

  1. ๋ง์”€์ฃผ์‹ ๋Œ€๋กœ Participants๊ฐ€ ๋‹จ์ˆœํžˆ Dealer์™€ Players๋ฅผ ๊บผ๋‚ด๊ธฐ๋งŒ ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ Dealer์™€ Players์—๊ฒŒ ๋ช…๋ น์„ ์ˆ˜ํ–‰ํ•˜๊ฑฐ๋‚˜ ๋‹ค๋ฃจ๋Š” ๋ฐฉํ–ฅ์œผ๋กœ ์ฑ…์ž„์„ ๋ถ€์—ฌํ•ด๋ดค์Šต๋‹ˆ๋‹ค.
  2. Result์™€ HitOrStand ํด๋ž˜์Šค๋ฅผ domain์œผ๋กœ ์˜ฎ๊ฒผ์Šต๋‹ˆ๋‹ค.
  3. Hand์— 10์ด๋ผ๋Š” ๋งค์ง๋„˜๋ฒ„๋ฅผ ์ƒ์ˆ˜ํ™”ํ–ˆ์Šต๋‹ˆ๋‹ค.
  4. Hand์— ์ ์ˆ˜๊ณ„์‚ฐ ๋กœ์ง์„ ๋ฉ”์„œ๋“œ๋กœ ์ถ”์ถœํ–ˆ์Šต๋‹ˆ๋‹ค.

์งˆ๋ฌธ

  1. ์˜๋„๋œ ์ค‘๋ณต์— ๋Œ€ํ•œ ์งˆ๋ฌธ

์ค‘๋ณต์„ ์ œ๊ฑฐํ•˜๋ผ ํ•˜์ง€๋งŒ ๋–„๋กœ๋Š” ์˜๋„๋œ ์ค‘๋ณต์„ ๋งŒ๋“ค๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค ๐Ÿ˜„

์˜๋„๋œ ์ค‘๋ณต์„ ๋งŒ๋“ค๊ธฐ๋„ ํ•œ๋‹ค๋Š” ์‚ฌ์‹ค์€ ์ถฉ๊ฒฉ์ ์ด๋„ค์š” ๐Ÿ˜ฎ
"์ค‘๋ณต"์— ๋Œ€ํ•ด 100% ๋ถ€์ •์ ์œผ๋กœ ๋ฐ”๋ผ๋ดค์—ˆ๋Š”๋ฐ, ๊ทธ๋ ‡์ง€ ์•Š์„ ์ˆ˜๋„ ์žˆ๋‹ค๋Š” ์‚ฌ์‹ค์„ ์ธ์ง€ํ•˜๊ณ  ์œ ์—ฐํ•˜๊ฒŒ ์ƒ๊ฐํ•ด๋ด์•ผ๊ฒ ์Šต๋‹ˆ๋‹ค!
ํ•œ ๊ฐ€์ง€ ๊ถ๊ธˆํ•œ ์ ์ด ์žˆ๋Š”๋ฐ, ์ฐฐ๋ฆฌ๋Š” constant ํŒจํ‚ค์ง€๋ฅผ ์‚ฌ์šฉํ•˜์‹œ๋Š” ํŽธ์ธ๊ฐ€์š”?
๋งŒ์•ฝ ์‚ฌ์šฉํ•˜์‹ ๋‹ค๋ฉด ์–ด๋–ค ๊ฒฝ์šฐ์—, ์–ด๋–ค ํด๋ž˜์Šค๋ฅผ ๊ณตํ†ต์œผ๋กœ ๊ด€๋ฆฌํ•˜๋Š” constant ํŒจํ‚ค์ง€๋กœ ๋ถ„๋ฆฌํ•˜์‹œ๋‚˜์š”?

  1. ์ฑ…์ž„ ๋ถ„๋ฆฌ์— ๋Œ€ํ•œ ์งˆ๋ฌธ

BlackjackGameManager ๊ฐ€ ์ŠนํŒจ์— ๋Œ€ํ•œ ํŒ๋‹จ์„ ํ•˜๋Š”๊ฒƒ์€ ์ฑ…์ž„์ด ๊ณผํ• ๊ฒƒ ๊ฐ™๋„ค์š” ๐Ÿค” ์ŠนํŒจ ํŒ๋‹จ์„ ํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ๋ถ„๋ฆฌํ•ด๋ณด๋Š”๊ฒƒ๋„ ์ข‹๊ฒ ์–ด์š”~

์ œ๊ฐ€ ์ƒ๊ฐํ–ˆ์„ ๋•Œ ํ˜„์žฌ ์Šน๋ฌดํŒจ ํŒ๋‹จ์„ ํ•˜๋Š” ๋ฉ”์„œ๋“œ๋Š” BlackjackGameManager ํด๋ž˜์Šค์˜ getBlackjackStatistics ๋ฉ”์„œ๋“œ ๋กœ์ง์ธ๋ฐ, ํŠนํžˆ ํ•ด๋‹น ๋ฉ”์„œ๋“œ ๋‚ด ์•„๋ž˜ 3์ค„์˜ ๋กœ์ง์ธ ๋“ฏ ํ•ฉ๋‹ˆ๋‹ค.

Result result = judgePlayerResult(participants.dealer(), player);
int playerProfit = calculatePlayerProfit(player, result);
dealerProfit += playerProfit * -1;

์ด ๋กœ์ง์„ ๊ฐ€์ง€๋Š” ๊ฐ์ฒด(A๋ผ๊ณ  ์ง€์นญํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค)๋ฅผ ๋”ฐ๋กœ ๋งŒ๋“ ๋‹ค๋ฉด A๋Š” judgePlayerResult ๋ฉ”์„œ๋“œ์™€ calculatePlayerProfit ๋ฉ”์„œ๋“œ๋ฅผ ํด๋ž˜์Šค ๋‚ด์—์„œ ๊ฐ€์งˆํ…๋ฐ, ์ด๋•Œ ๋ณด์‹œ๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ๋ฉ”์„œ๋“œ์˜ ์ธ์ˆ˜๋กœ Dealer์™€ Player๊ฐ€ ๋“ค์–ด๊ฐ€๊ธฐ๋•Œ๋ฌธ์— A๊ฐ€ Dealer์™€ Player์—๊ฒŒ ์˜์กดํ•˜๊ฒŒ ๋˜๊ณ , ๊ฒฐํ•ฉ๋„๊ฐ€ ์ปค์ง€๊ฒŒ ๋˜์ง€ ์•Š์„๊นŒ๋ผ๋Š” ๋ถ€๋ถ„์ด ์—ผ๋ ค๋ฉ๋‹ˆ๋‹ค. ๊ฒฐํ•ฉ๋„๊ฐ€ ์ปค์ง€๋ฉด ์ˆ˜์ •๋ฒ”์œ„๊ฐ€ ์ปค์ง€๊ฒŒ ๋˜๋Š” ๋‹จ์ ์ด ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

์ด ๋ถ€๋ถ„์— ๋Œ€ํ•œ ์ฐฐ๋ฆฌ์˜ ์˜๊ฒฌ์ด ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค!

  1. ์›์‹œ๊ฐ’ ํฌ์žฅ์— ๋Œ€ํ•œ ์งˆ๋ฌธ

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

1์ฐจ ํ”ผ๋“œ๋ฐฑ ์ˆ˜์ • ์š”์†Œ

  1. ๋”œ๋Ÿฌ๊ฐ€ ๋ธ”๋ž™์žญ์ธ ๊ฒฝ์šฐ ๊ณ ๋ คํ•ด์„œ ์ŠนํŒจ ๋กœ์ง ์ˆ˜์ • ๊ตฌํ˜„
  2. Participant์— getName ๋ฉ”์„œ๋“œ ์ถ”์ƒํ™”
  3. ๋ฒ ํŒ…๊ธˆ์•ก์„ ๋‹ค ์ž…๋ ฅ๋ฐ›์€ ํ›„ ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์ƒ์„ฑํ•˜๋„๋ก ์ˆ˜์ • -> Player์˜ BetAmount์ด ์ฐธ์กฐ๊ฐ’์„ null๋กœ ๊ฐ€์ง€์ง€ ์•Š๋„๋ก ์•ˆ์ •์„ฑ์„ ๋†’์—ฌ์คŒ
  4. PlayerName๋„ ์ปจํŠธ๋กค๋Ÿฌ์—์„œ ์ƒ์„ฑ(๊ฒ€์ฆ ํฌํ•จ)ํ•ด์„œ ๋„˜๊ธฐ๋„๋ก ์ˆ˜์ •
  5. BetAmount์˜ isPositive ๋ฉ”์„œ๋“œ isNotPositive๋กœ ๋ฉ”์„œ๋“œ๋ช… ์ˆ˜์ •
  6. ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์นด๋“œ๋ฅผ ๋ฝ‘์•„ ๋ฒ„์ŠคํŠธ๊ฐ€ ๋˜๋ฉด ๋‹ค์Œ ์ฐจ๋ก€๋กœ ๋„˜์–ด๊ฐ€๋„๋ก ์ˆ˜์ •
  7. Hand์˜ calculateAceCount ์ˆ˜์ •
  8. OutputView ์•ˆ์“ฐ๋Š” ๋ฉ”์„œ๋“œ ์‚ญ์ œ
  9. ๊ฒฐ๊ณผ์— ๋Œ€ํ•œ ๋ฐฐ๋‹น์„ BlackjackGameManager์˜ calculatePlayerProfit ๋ฉ”์„œ๋“œ ์‚ญ์ œ ๋ฐ ํ•ด๋‹น ๋กœ์ง์— ๋Œ€ํ•œ ์ฑ…์ž„์„ Result๊ฐ€ ๊ฐ€์ง€๋„๋ก ์ˆ˜์ •
  10. ์ŠนํŒจ ๋ฐ ์ˆ˜์ต ๊ณ„์‚ฐ ๋กœ์ง ๊ฐ์ฒด ๋ถ„๋ฆฌ ๋ฐ ์ŠนํŒจํŒ๋‹จ ๋กœ์ง ์ˆ˜์ • -> BlackjackJudge
 1. ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๋ฒ„์ŠคํŠธ -> ํ”Œ๋ ˆ์ด์–ด LOSE
 2. ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๋ธ”๋ž™์žญ(์ „์ œ: ํ”Œ๋ ˆ์ด์–ด๋Š” ๋ฒ„์ŠคํŠธ ์•„๋‹˜) && ๋”œ๋Ÿฌ๊ฐ€ ๋ธ”๋ž™์žญ์ด๋ฉด -> DRAW
 3. ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๋ธ”๋ž™์žญ(์ „์ œ: ํ”Œ๋ ˆ์ด์–ด๋Š” ๋ฒ„์ŠคํŠธ ์•„๋‹˜) && ๋”œ๋Ÿฌ๊ฐ€ ๋ธ”๋ž™์žญ์•„๋‹ˆ๋ฉด -> ํ”Œ๋ ˆ์ด์–ด BLACKJACK_WIN
 4. ๋”œ๋Ÿฌ๊ฐ€ ๋ฒ„์ŠคํŠธ(์ „์ œ: ํ”Œ๋ ˆ์ด์–ด๋Š” ๋ฒ„์ŠคํŠธ ๋˜๋Š” ๋ธ”๋ž™์žญ ์•„๋‹˜) -> ํ”Œ๋ ˆ์ด์–ด WIN
 5. ํ”Œ๋ ˆ์ด์–ด ์ ์ˆ˜ > ๋”œ๋Ÿฌ ์ ์ˆ˜(์ „์ œ: ํ”Œ๋ ˆ์ด์–ด์™€ ๋”œ๋Ÿฌ๋Š” ๋ฒ„์ŠคํŠธ ๋˜๋Š” ๋ธ”๋ž™์žญ ์•„๋‹˜) -> ํ”Œ๋ ˆ์ด์–ด WIN
 6. ํ”Œ๋ ˆ์ด์–ด ์ ์ˆ˜ == ๋”œ๋Ÿฌ ์ ์ˆ˜(์ „์ œ: ํ”Œ๋ ˆ์ด์–ด์™€ ๋”œ๋Ÿฌ๋Š” ๋ฒ„์ŠคํŠธ ๋˜๋Š” ๋ธ”๋ž™์žญ ์•„๋‹˜) -> DRAW
 7. 1~6 ์•„๋‹˜ -> ํ”Œ๋ ˆ์ด์–ด LOSE
  1. record ํด๋ž˜์Šค๋Š” equals, hashCode ๋ฉ”์„œ๋“œ ์ž๋™ ๊ตฌํ˜„์ด๋ฏ€๋กœ Card์˜ equals ์‚ญ์ œ

2์ฐจ ํ”ผ๋“œ๋ฐฑ ์ˆ˜์ • ์š”์†Œ

  1. dto ํ…Œ์ŠคํŠธ ์‚ญ์ œ
  2. Hand์˜ isBlackjack() ๋ฉ”์„œ๋“œ ์ˆ˜์ • ๋ฐ calculateInitialScore, calculateInitialBaseScore ๋ฉ”์„œ๋“œ ์‚ญ์ œ
  3. BlackjackGameManager์˜ ํ•„๋“œ(CardMachine, BlackjackJudge)๊ฐ’ ์˜์กด์„ฑ ์ฃผ์ž…์œผ๋กœ ๊ตฌํ˜„ -> BlackjackFactory๋กœ ์ด๋ฆ„ ์ˆ˜์ •
  4. BlackjackController๊ฐ€ BlackjackGameManager๋ฅผ ํ•„๋“œ๋กœ ๊ฐ€์ง€์ง€ ์•Š๊ณ  ๋ฉ”์„œ๋“œ๋“ค์˜ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋‘๋„๋ก ์ˆ˜์ •

3์ฐจ ํ”ผ๋“œ๋ฐฑ ์ˆ˜์ • ์š”์†Œ

  1. dto ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์‚ญ์ œ
  2. BlackjackGameManager์˜ Participants ํ•„๋“œ๊ฐ’์„ ๋ถˆ๋ณ€์œผ๋กœ ์ง€์ •ํ•˜๊ณ  ์ƒ์„ฑ์ž์—์„œ ๊ฐ’์ด ํ• ๋‹น๋˜๋„๋ก ์ˆ˜์ •
  3. BlackjackJudge์˜ ์ŠนํŒจํŒ๋‹จ ๋ฉ”์„œ๋“œ์—์„œ ๋ถ„๊ธฐ ์ฝ”๋“œ ์ค‘๋ณต ์ œ๊ฑฐ
  4. ์ปจํŠธ๋กค๋Ÿฌ์˜ start ๋ฉ”์„œ๋“œ ๋‚ด์—์„œ BlackjackGameManager๋ฅผ ์ƒ์„ฑํ•˜๋„๋ก ์ˆ˜์ •
  5. BlackjackGameManager๋ฅผ ์ƒ์„ฑํ•˜๋Š” BlackjackGameManagerFactory ํด๋ž˜์Šค ์ƒ์„ฑ ๋ฐ ๋„๋ฉ”์ธ ํŒจํ‚ค์ง€์— ์œ„์น˜
  6. Participants, Players์˜ playerIsBust ๋ฉ”์„œ๋“œ isPlayerBust๋กœ ๋ฉ”์„œ๋“œ๋ช… ์ˆ˜์ •

khcho96 added 30 commits March 13, 2026 08:45
โ€ฆialScore() ๋ฉ”์„œ๋“œ ๊ตฌํ˜„
โ€ฆmeManager ๋ฉ”์„œ๋“œ๋ช… ๋ณ€๊ฒฝ
khcho96 added 12 commits March 15, 2026 23:50
โ€ฆackGameManager๋ฅผ ์ธ์ˆ˜๋กœ ๋„˜๊ธฐ์ง€ ์•Š๋„๋ก ์ˆ˜์ •
โ€ฆackjackGameManager๋ฅผ ์ธ์ˆ˜๋กœ ๋„˜๊ธฐ๋„๋ก ์ˆ˜์ •
โ€ฆper() ์‚ฌ์šฉํ•˜๋„๋ก ์ˆ˜์ •
Copy link

@Gomding Gomding left a comment

Choose a reason for hiding this comment

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

์•ˆ๋…•ํ•˜์„ธ์š” ์ œ์ด์ฝฅ!
ํ”ผ๋“œ๋ฐฑ ์ž˜ ๋ฐ˜์˜ํ•ด์ฃผ์…จ๋„ค์š”~
์ถ”๊ฐ€๋กœ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒผ์œผ๋‹ˆ ํ™•์ธ๋ถ€ํƒ๋“œ๋ ค์š” :)

๊ถ๊ธˆํ•œ ์  ์žˆ์œผ๋ฉด ์–ธ์ œ๋“  DM ์ด๋‚˜ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒจ์ฃผ์„ธ์š”

Copy link

Choose a reason for hiding this comment

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

  1. ์˜์กด์ด ์žˆ๋Š”๊ฒƒ์€ ์–ด์ฉ” ์ˆ˜ ์—†์ด BlackjackGameManager ์˜ ๋ณ€๊ฒฝ์— ์˜ํ–ฅ์„ ๋ฐ›์„ ์ˆ˜ ๋ฐ–์— ์—†๊ฒ ์ฃ  :)
    Controller ๊ฐ€ BlackjackGameManager ๋ฅผ ์˜์กดํ•˜๋Š”๊ฒƒ์€ ๋‹น์—ฐํ•œ ์˜์กด์ด ์•„๋‹๊นŒ์š”? ๐Ÿค”
    ์˜์กดํ•˜์ง€์•Š๊ณ  ๋ธ”๋ž™์žญ ๊ฒŒ์ž„์„ ํ•˜๋Š”๊ฒŒ ๊ฐ€๋Šฅํ• ๊นŒ์š”? ๐Ÿ˜ƒ

  2. Controller ๋ฅผ ์ƒˆ๋กœ ์ƒ์„ฑํ•˜๋Š”๊ฒƒ์ด ์ž์—ฐ์Šค๋Ÿฝ๋‚˜์š”? BlackjackGameManager ๋ฅผ ์ƒˆ๋กœ ์ƒ์„ฑํ•˜๋Š”๊ฒƒ์ด ์ž์—ฐ์Šค๋Ÿฝ๋‚˜์š”?
    ์—ญํ• ์˜ ๊ด€์ ์—์„œ ๊ณ ๋ฏผํ•ด๋ณผ ์ˆ˜ ์žˆ๊ฒ ๋„ค์š”. ์ œ์ด์ฝฅ์€ Controller ์˜ ์—ญํ• ์„ ๋ฌด์—‡์œผ๋กœ ๋ณด๊ณ ์žˆ๋‚˜์š”?

++) start ์˜ ์ธ์ž๋กœ ๋ฐ›์•„์•ผํ•  ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”?
start ๋‚ด๋ถ€์—์„œ BlackjackGameManager ๋ฅผ ์ƒ์„ฑํ•˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿค”
์ €๋Š” BlackjackGameManager ๋ฅผ Main ๊นŒ์ง€ ๋…ธ์ถœํ•  ํ•„์š”๊ฐ€ ์—†๋‹ค๊ณ  ์ƒ๊ฐํ•ด์„œ์š”!

Comment on lines +16 to +25
public BlackjackGameManager blackjackGameManager() {
return new BlackjackGameManager(cardMachine(), blackjackJudge());
}

private CardMachine cardMachine() {
return new CardMachine();
}

private BlackjackJudge blackjackJudge() {
return new BlackjackJudge();
Copy link

Choose a reason for hiding this comment

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

BlackjackControllerFactory ๋ผ๋Š” ์ด๋ฆ„์„ ๋ณ€๊ฒฝํ•˜๋ฉด์„œ๊นŒ์ง€
์—ฌ๊ธฐ์— ๋„๋ฉ”์ธ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ์ฑ…์ž„์„ ์œ„์น˜ํ•œ ์ด์œ ๊ฐ€ ๊ถ๊ธˆํ•ด์š”!

๊ผญ Factory ๊ฐ์ฒด๋Š” ํ•˜๋‚˜๋งŒ ์กด์žฌํ•ด์•ผํ• ๊นŒ์š”?
๋„๋ฉ”์ธ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š”๊ฒƒ์€ domain ํŒจํ‚ค์ง€์— ๋„ฃ์ง€์•Š์€ ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”?


private final CardMachine cardMachine;
private final BlackjackJudge blackjackJudge;
private Participants participants;
Copy link

Choose a reason for hiding this comment

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

์ƒ์„ฑ์ž์—์„œ ์ดˆ๊ธฐํ™”ํ•˜์ง€ ์•Š๋Š”๊ฒŒ final ์ด ์•„๋‹Œ ์ด์œ ์™€ ์ด์–ด์งˆ ๊ฒƒ ๊ฐ™๋„ค์š” :)
๋ถˆ๋ณ€์œผ๋กœ ๋งŒ๋“œ๋Š”๊ฒƒ์„ ํ•ญ์ƒ ๊ณ ๋ คํ•ด๋ณด์‹œ๋ฉด ์ข‹๊ฒ ์–ด์š”!

import domain.participant.Dealer;
import domain.participant.Player;

public record BlackjackJudge() {
Copy link

Choose a reason for hiding this comment

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

record ์ธ ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”?
์ œ์ด์ฝฅ์ด ์ƒ๊ฐํ•˜๋Š” record ๋Š” ์–ด๋–ค ๊ฐ์ฒด์ธ๊ฐ€์š”? ๐Ÿค”

Comment on lines 87 to 89
public boolean playerIsBust(String name) {
return participants.playerIsBust(name);
}
Copy link

Choose a reason for hiding this comment

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

isPlayerBust ๋กœ ์ด๋ฆ„์„ ๋ณ€๊ฒฝํ•˜๋ฉด ์ข‹์„๊ฒƒ ๊ฐ™์•„์š”!

khcho96 added 15 commits March 17, 2026 06:50
โ€ฆpants ํ•„๋“œ final ์ง€์ •์œผ๋กœ ์ƒ์„ฑ์ž์—์„œ ๊ฐ’ ํ• ๋‹น๋˜๋„๋ก ์ˆ˜์ •
โ€ฆackjackJudge() ๋ฉ”์„œ๋“œ ์‚ญ์ œ
blackjackGameManager() ํ˜ธ์ถœ ์ œ๊ฑฐ
Copy link

@Gomding Gomding left a comment

Choose a reason for hiding this comment

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

์•ˆ๋…•ํ•˜์„ธ์š” ์ œ์ด์ฝฅ~
์ด์ œ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ธธ๊ฒƒ์ด ๊ฑฐ์˜ ์—†๋„ค์š”
์ถ”๊ฐ€๋กœ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒผ์œผ๋‹ˆ ํ™•์ธ๋ถ€ํƒ๋“œ๋ ค์š”!
๋‹ค์Œ ์š”์ฒญ์—๋Š” ๋จธ์ง€ํ•  ๊ฒƒ ๊ฐ™์€๋ฐ ์ถ”๊ฐ€๋กœ ๊ถ๊ธˆํ•œ ๋ถ€๋ถ„์žˆ์œผ๋ฉด ์•Œ๋ ค์ฃผ์„ธ์š” :)

Comment on lines +22 to +20
public BlackjackGameManager(CardMachine cardMachine, BlackjackJudge blackjackJudge) {
public BlackjackGameManager(CardMachine cardMachine, BlackjackJudge blackjackJudge, Participants participants) {
Copy link

Choose a reason for hiding this comment

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

์ฝ”๋ฉ˜ํŠธ ๋“œ๋ฆฐ ์ด์œ ๋Š” ๊ฐ์ฒด๋Š” ์™„์ „ํ•œ ์ƒํƒœ๋กœ ์ดˆ๊ธฐํ™” ํ•ด์ฃผ๋Š”๊ฒŒ ์ข‹๋‹ค๊ณ  ์ƒ๊ฐํ•ด์š”
์ผ๋ถ€ ํ•„๋“œ๋ฅผ ๋‚˜์ค‘์— ์ดˆ๊ธฐํ™” ํ•˜๋Š”๊ฒƒ์€ ์ฒ˜์Œ ๊ฐ์ฒด ์ƒ์„ฑ ์‹œ ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ƒํƒœ์ธ์ง€ ๊ณ ๋ฏผํ•ด๋ณด๋ฉด ์ข‹์•„์š”

๋ฌผ๋ก  ๋‚˜์ค‘์— ์ดˆ๊ธฐํ™”ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์•„์˜ˆ ์—†๋Š”๊ฒƒ์€ ์•„๋‹™๋‹ˆ๋‹ค! ๐Ÿ˜„

Comment on lines +24 to +25
if (player.calculateScore() == dealer.calculateScore()) {
return Result.DRAW;
Copy link

Choose a reason for hiding this comment

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

๋”œ๋Ÿฌ๊ฐ€ ๋ธ”๋ž™์žญ ์ด๊ณ  ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ผ๋ฐ˜ 21์  ์ผ ๋•Œ ๋ฌด์Šน๋ถ€๋กœ ํŒ๋‹จ๋  ์ˆ˜ ์žˆ๊ฒ ๋„ค์š”!

public static final String INVALID_BET_AMOUNT_POSITIVE = "๋ฐฐํŒ… ๊ธˆ์•ก์€ ์–‘์ˆ˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.";
private static final String NUMBER_FORMAT = "-?\\d+";

private final int betAmount;
Copy link

Choose a reason for hiding this comment

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

๋ฒ ํŒ… ๊ธˆ์•ก์— ๋Œ€ํ•ด์„œ int, long BigDecimal, BigInteger ๋“ฑ์˜ ํƒ€์ž…๋„ ๊ณ ๋ฏผํ•ด๋ณด์…จ์„๊นŒ์š”?

private final List<Player> players;

public Players(List<String> names) {
public Players(List<PlayerName> names, List<BetAmount> betAmounts) {
Copy link

Choose a reason for hiding this comment

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

์ž…๋ ฅ๋ฐ›์€ names ์™€ betAmounts ์˜ size ์— ๋Œ€ํ•œ ๊ฒ€์ฆ๋„ ์žˆ์–ด์•ผ๊ฒ ๊ตฐ์š” ๐Ÿค”

Comment on lines +20 to +21
dealer.addCard(cardSupplier.get());
dealer.addCard(cardSupplier.get());
Copy link

Choose a reason for hiding this comment

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

dealer ์—๊ฒŒ 2๋ฒˆ ์š”์ฒญํ•˜์ง€์•Š๊ณ 
์นด๋“œ๋ฅผ 2์žฅ ๋ฝ‘์œผ๋ผ๊ณ  ํ•œ ๋ฒˆ๋งŒ ์š”์ฒญํ•  ์ˆ˜ ์žˆ๊ฒ ๋„ค์š” ๐Ÿ˜„

Copy link

@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.

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

import view.InputView;
import view.OutputView;

public class BlackjackControllerFactory {

Choose a reason for hiding this comment

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

ํŒฉํ† ๋ฆฌ ํด๋ž˜์Šค๋ฅผ ๋”ฐ๋กœ ๋‘” ์ด์œ ๊ฐ€ ๋ญ์ฃ ?

private final BlackjackGameManager blackjackGameManager;

public BlackjackController(InputView inputView, OutputView outputView, BlackjackGameManager blackjackGameManager) {
public BlackjackController(InputView inputView, OutputView outputView) {

Choose a reason for hiding this comment

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

์™œ ํด๋ž˜์Šค๋ช…์„ ์ปจํŠธ๋กค๋Ÿฌ๋ผ ์ด๋ฆ„ ๋ถ™์˜€์ฃ ?

}

private void addRepeatSix(List<Card> decks, Rank rank, Suit suit) {
private void addRepeatDeckCount(List<Card> decks, Rank rank, Suit suit) {

Choose a reason for hiding this comment

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

์™œ ํ•จ์ˆ˜๋ช…์— add๋ฅผ ๋ถ™์ด์…จ๋‚˜์š”?

}

public boolean isBlackjack() {
return calculateTotalScore() == BLACKJACK_SCORE && cards.size() == 2;

Choose a reason for hiding this comment

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

2๊ฐ€ ๋ฌด์—‡์„ ์˜๋ฏธํ•˜๋‚˜์š”? ์ƒ์ˆ˜๋กœ ์ถ”์ถœํ•ด์„œ ์˜๋ฏธ ์žˆ๋Š” ์ด๋ฆ„์„ ๋ถ€์—ฌํ•˜์„ธ์š”

import domain.participant.PlayerName;
import java.util.List;

public class BlackjackGameManagerFactory {

Choose a reason for hiding this comment

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

์ด ํด๋ž˜์Šค๋Š” ์™œ ๋งŒ๋“ ๊ฑด๊ฐ€์š”?


public final class BlackjackJudge {

public Result judgePlayerResult(Dealer dealer, Player player) {

Choose a reason for hiding this comment

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

if์ ˆ์ด ๋„ˆ๋ฌด ๋งŽ๊ณ  ํ•จ์ˆ˜๊ฐ€ ๋„ˆ๋ฌด ๊ธธ์–ด ์ฝ”๋“œ ํŒŒ์•…ํ•˜๊ธฐ๊ฐ€ ์–ด๋ ต๋„ค์š”
๋‹ค๋ฅธ ํŒ€์›๋“ค๋„ ์ด ์ฝ”๋“œ๋ฅผ ๋ณด๊ณ  ๋กœ์ง ํŒŒ์•…ํ•˜๊ธฐ๊ฐ€ ์‰ฝ์ง€ ์•Š์„ํ…๋ฐ์š”, ํ•จ์ˆ˜๊ฐ€ 10์ค„ ๋„˜์–ด๊ฐ€์ง€ ์•Š๋„๋ก ๊ฐœ์„ ํ•ด๋ณด์„ธ์š”

@@ -0,0 +1,19 @@
package domain.game;

public enum Result {

Choose a reason for hiding this comment

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

๋ฌด์Šจ ๊ฒฐ๊ณผ์—์š”?


private final int betAmount;

public BetAmount(String betAmountInput) {

Choose a reason for hiding this comment

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

๋ณ€์ˆ˜๋ช…์— input์„ ๋ถ™์ผ ํ•„์š”๊ฐ€ ์žˆ๋‚˜์š”?

import java.util.List;
import java.util.function.Supplier;

public record Participants(Dealer dealer, Players players) {

Choose a reason for hiding this comment

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

ํด๋ž˜์Šค๋ช…์€ ์ฐธ์—ฌ์ž๋“ค์ธ๋ฐ ์ด๋ฆ„๋งŒ ๋ด์„œ๋Š” ๋ฌด์Šจ ์ผ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ํด๋ž˜์Šค์ธ์ง€ ํŒŒ์•…์ด ์–ด๋ ต๋„ค์š”
๊ทธ๋ฆฌ๊ณ  record๋กœ ๋งŒ๋“  ์ด์œ ๋Š” ๋ญ”๊ฐ€์š”?

import constant.Result;
import domain.participant.Player;

public record PlayerStatisticDto(

Choose a reason for hiding this comment

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

dto๊ฐ€ ๋ญ”๊ฐ€์š”? dto๊ฐ€ ํ•„์š”ํ•œ๊ฐ€์š”?

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