Skip to content

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

Open
Eian1106 wants to merge 20 commits intowoowacourse:eian1106from
Eian1106:step2
Open

Conversation

@Eian1106
Copy link

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

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

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

์•ˆ๋…•ํ•˜์„ธ์š” ์ดˆ์ฝ”์นฉ!
๋งŽ์ด ๋ถ€์กฑํ•œ ์ œ ์ฝ”๋“œ๋ฅผ ๋ด์ฃผ์‹œ๊ณ  ๋ฆฌ๋ทฐ ํ•ด ์ฃผ์…”์„œ ์ •๋ง ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.. ๐Ÿฅบ ์ด๋ฒˆ์—๋„ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค!

  • ์‚ฌ์ดํด1 ๋งˆ์ง€๋ง‰ ํ”ผ๋“œ๋ฐฑ์€ ์•„์ง ์ ์šฉํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.
    ๊ธˆ์š”์ผ ํ”ผ๋“œ๋ฐฑ ํ™œ๋™์ธ ๋ณ€๊ฒฝ ๋ฒ”์œ„ ๋น„๊ต: ์‚ฌ์ดํด1 vs ์‚ฌ์ดํด2 ์„ ์šฐ์„ ์ ์œผ๋กœ ํ™•์ธํ•˜๊ณ  ์‹ถ์—ˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

Controller์—์„œ ์Šน๋ฌดํŒจ ๋กœ์ง์„ ์˜๋„์ ์œผ๋กœ ์ฃผ์„์ฒ˜๋ฆฌ ํ–ˆ์Šต๋‹ˆ๋‹ค.

// ResultView.printResult(gameService.result());

์ง€๊ธˆ์€ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์งˆ๋ฌธ์„ ์กฐ๊ธˆ ํ•˜๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค..
์ดˆ์ฝ”์นฉ์˜ ์ƒ๊ฐ์ด ๊ถ๊ธˆํ•ด์š”!

  • ๋ฉ”์„œ๋“œ๋ช…๊ณผ ๋ณ€์ˆ˜๋ช…์„ ์ง“๋Š” ๊ฒŒ ์–ด๋ ต์Šต๋‹ˆ๋‹ค.

    • AI๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ํ•ด๋ณด๋ ค ๋…ธ๋ ฅ์ค‘์ž…๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋ฉ”์„œ๋“œ๋ช…๊ณผ ๋ณ€์ˆ˜๋ช… ์ž‘์„ฑ์€ ์ถ”ํ›„ ๋‚˜๋ฅผ ์œ„ํ•ด์„œ๋‚˜, ๋‚ด ์ฝ”๋“œ๋ฅผ ๋ณด๋Š” ๋ชจ๋“  ์ด๋“ค์„ ์œ„ํ•ด ์ž˜ ์ง€์–ด์•ผ ํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ์ง€๊ธˆ์€ ๊ตฌ๊ธ€ ๋ฒˆ์—ญ๊ธฐ๋‚˜ ๋‹จ์–ด ๊ฒ€์ƒ‰์„ ํ†ตํ•ด ์ž‘์„ฑํ•˜๊ณค ํ•ฉ๋‹ˆ๋‹ค..

    • Q) ๋„ค์ด๋ฐ ๊ฐ™์€ ๊ฒฝ์šฐ๋Š” AI๋ฅผ ์‚ฌ์šฉํ•ด๋„ ๋ฌด๋ฐฉํ• ๊นŒ์š”?

  • ๋ธ”๋ž™์žญ ์™„๋ฃŒ ํ›„ ์–ด๋–ค ๊ณต๋ถ€๋ฅผ ํ•˜๋ฉด ์ข‹์„๊นŒ์š”?

    • ๋‹ค๋ฅธ ํฌ๋ฃจ์˜ ์ฝ”๋“œ์™€ ๋น„๊ตํ•ด๋ณด๋ฉด ์ œ ์ฝ”๋“œ๋Š” ์ •๋ˆ๋˜์ง€ ์•Š์€ ๋А๋‚Œ์ž…๋‹ˆ๋‹ค. ๋…ธ๋ ฅ์€ ํ–ˆ๋‹ค๊ณ  ์ž์‹ ํ•  ์ˆ˜ ์žˆ์œผ๋‚˜, ๊ฒฐ๊ณผ๋ฌผ์€ ๐Ÿค” ..
      ๊ทธ๋ž˜์„œ ์ข‹์€ ์ฝ”๋“œ, ๋‚˜์œ ์ฝ”๋“œ๋ฅผ ์ฝ์–ด๋ณผ๊นŒ ์‹ถ๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ๊ณต๋ถ€๋Š” ์ง„ํ–‰ ํ•  ์˜ˆ์ •์ด์ง€๋งŒ ๊ณต๋ถ€ ์ˆœ์„œ์— ๊ณ ๋ฏผ์ด ์ƒ๊น๋‹ˆ๋‹ค.
      ๊ฐ์ฒด์ง€ํ–ฅ์˜ ์‚ฌ์‹ค๊ณผ ์˜คํ•ด๋Š” ์ฝ์–ด๋ณด์•˜์œผ๋‚˜ ์ฒดํ™” ํ•˜๊ธฐ์—” ๋ถ€์กฑํ–ˆ๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ณ ๋ฏผ์ค‘์ธ ๋„์„œ(๊ณต๋ถ€) ํ›„๋ณด๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

      • ์ข‹์€ ์ฝ”๋“œ, ๋‚˜์œ ์ฝ”๋“œ
      • ํด๋ฆฐ ์ฝ”๋“œ
      • ํด๋ฆฐ ์•„ํ‚คํ…์ฒ˜
      • ์˜ค๋ธŒ์ ํŠธ
      • TDD ๊ด€๋ จ
      • JAVA ๊ด€๋ จ

      ํ•ด์•ผ ํ•  ๊ณต๋ถ€๋Š” ๋งŽ์ง€๋งŒ, ๋ฐฉํ–ฅ์„ฑ์— ๋Œ€ํ•ด์„œ ๊ฐˆํ”ผ๋ฅผ ๋ชป ์žก๊ณ  ์žˆ๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!.. ์กฐ์–ธ ํ•ด์ฃผ์‹ค ์ˆ˜ ์žˆ์„๊นŒ์š”?

Copy link

@Chocochip101 Chocochip101 left a comment

Choose a reason for hiding this comment

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

์•ˆ๋…•ํ•˜์„ธ์š”, ์ด์•ˆ! ๋ฆฌ๋ทฐ์–ด ์ดˆ์ฝ”์นฉ์ž…๋‹ˆ๋‹ค ๐Ÿช
ํ”ผ๋“œ๋ฐฑ๊ณผ ๋ณ€๊ฒฝ์ ์ด ๋งŽ์•„์ ธ์„œ ๋‚˜๋ˆ ์„œ ๋ฆฌ๋ทฐํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
์ปค๋งจํŠธ๋กœ ๋ฆฌ๋ทฐ ๋‚จ๊ฒผ์œผ๋‹ˆ ํ™•์ธ ํ›„ ์žฌ์š”์ฒญ์ฃผ์„ธ์š”~
๊ทธ๋ฆฌ๊ณ  ์‚ฌ์ดํด1 ๋งˆ๋ฌด๋ฆฌ์— ๋‚จ๊ธด ๋ฆฌ๋ทฐ๋„ ๋ฐ˜์˜ํ•ด์ฃผ์„ธ์š”!


for (Map.Entry<String, WinStatus> playerWinStatus : playerGroups.getGameResult().entrySet()) {
String userName = playerWinStatus.getKey();
int userCost = (int) (userBetInfo.get(userName) * playerWinStatus.getValue().getEarningsRate());

Choose a reason for hiding this comment

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

int๋กœ ํ˜•๋ณ€ํ™˜ํ•˜๋ฉด ์†Œ์ˆ˜์ ์€ ์ „๋ถ€ ์ž˜๋ฆฌ๊ฒ ๊ตฐ์š”.

Choose a reason for hiding this comment

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


private Map<String, Integer> bettingRound() {
List<Player> players = gameService.getPlayers();
Map<String, Integer> userBetCost = new HashMap<>();

Choose a reason for hiding this comment

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

์ž๋ฃŒํ˜•๋ณด๋‹ค๋Š” ๊ฐ์ฒด๋กœ ํ‘œํ˜„ํ•˜๋Š” ๊ฒƒ์€ ์–ด๋–ค๊ฐ€์š”?

public void run() {
startGame();

Map<String, Integer> userBetInfo = bettingRound();

Choose a reason for hiding this comment

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

๊ธˆ์•ก์ด ์Œ์ˆ˜๋„ ๊ฐ€๋Šฅํ•˜๋„ค์š”. ๋ฐฐํŒ… ๊ธˆ์•ก์—๋„ ํ•„์š”ํ•œ ๊ฒ€์ฆ ๋กœ์ง์ด ํ•„์š”ํ•ด๋ณด์ด๋„ค์š”.

Choose a reason for hiding this comment

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

๋ฐฐํŒ… ๊ธˆ์•ก๋„ ์›์‹œ ํƒ€์ž…์ด ์•„๋‹Œ ๊ฐ์ฒด๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์„๊นŒ์š”?

return playerGroups.getGameResult();
}

public List<ParticipantBetResult> bettingResult(Map<String, Integer> userBetInfo) {

Choose a reason for hiding this comment

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

๋ฐฐํŒ… ๊ด€๋ จ ํ…Œ์ŠคํŠธ๊ฐ€ ์—†์–ด์š”. ๋ธ”๋ž™์žญ์ผ ๋•Œ์˜ ๊ธˆ์•ก ๋กœ์ง, ๋”œ๋Ÿฌ๊ฐ€ ์กŒ์„ ๋•Œ ๋ˆ์„ ์žƒ๋Š”์ง€ ๋“ฑ๋“ฑ์ด์š”. ๋งŽ์€ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๊ฐ€ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”.

๋ชจ๋“  ์œ ์ฆˆ ์ผ€์ด์Šค ํ…Œ์ŠคํŠธ๋กœ ๊ฒ€์ฆ๋˜๋„๋ก ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”.


public List<ParticipantBetResult> bettingResult(Map<String, Integer> userBetInfo) {
List<ParticipantBetResult> profitResults = new ArrayList<>();
int dealerCost = 0;

Choose a reason for hiding this comment

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

dealerCost๋Š” ์„œ๋น„์Šค๊ฐ€ ๊ด€๋ฆฌํ•˜๊ณ  ์žˆ๋„ค์š”. dealer๋„ ๊ธˆ์•ก์ด ์žˆ๊ณ , participant๋„ ๊ธˆ์•ก์ด ์žˆ๋Š”๋ฐ ๊ตณ์ด ์„œ๋น„์Šค๊ฐ€ ๊ด€๋ฆฌํ•  ํ•„์š”๊ฐ€ ์žˆ์„๊นŒ์š”?

@Eian1106
Copy link
Author

int๋กœ ํ˜•๋ณ€ํ™˜ํ•˜๋ฉด ์†Œ์ˆ˜์ ์€ ์ „๋ถ€ ์ž˜๋ฆฌ๊ฒ ๊ตฐ์š”.

  • ์ดˆ๊ธฐ ๋ฒ ํŒ… ๊ธˆ์•ก ์ž…๋ ฅ์„ 100 ์ด์ƒ์œผ๋กœ ์ œํ•œํ•˜๋„๋ก ๋ณ€๊ฒฝํ•จ์œผ๋กœ์จ,
    ๋ธ”๋ž™์žญ ์Šน๋ฆฌ์‹œ 1.5๋ฐฐ ํ•˜๋”๋ผ๋„, ์†Œ์ˆ˜์ ์ด ์ƒ๊ธฐ์ง€ ์•Š๋„๋ก ํ•˜์˜€์Šต๋‹ˆ๋‹ค!

dealerCost๋Š” ์„œ๋น„์Šค๊ฐ€ ๊ด€๋ฆฌํ•˜๊ณ  ์žˆ๋„ค์š”. dealer๋„ ๊ธˆ์•ก์ด ์žˆ๊ณ , participant๋„ ๊ธˆ์•ก์ด ์žˆ๋Š”๋ฐ ๊ตณ์ด ์„œ๋น„์Šค๊ฐ€ ๊ด€๋ฆฌํ•  ํ•„์š”๊ฐ€ ์žˆ์„๊นŒ์š”?

  • ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์š”๊ตฌ ์‚ฌํ•ญ์ธ 3๊ฐœ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค ๋ณ€์ˆ˜๋ฅผ ๊ฐ€์ง„ ํด๋ž˜์Šค๋ฅผ ์“ฐ์ง€ ์•Š๋Š”๋‹ค. ๊ฐ€ ์•„๋‹ˆ์˜€๋‹ค๋ฉด participant๊ฐ€ ๊ด€๋ฆฌํ•˜๋„๋ก ํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค... dealerCost๋Š” ๋ฒ ํŒ… ๊ฒฐ๊ณผ ๊ณ„์‚ฐ ์ „ ๊นŒ์ง€ ์‚ฌ์šฉ๋˜์ง€ ์•Š๋Š”๋‹ค๊ณ  ํŒ๋‹จํ•ด์„œ bettingResult() ๋‚ด๋ถ€์—์„œ ๊ด€๋ฆฌํ•˜๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.๐Ÿค”
    dealerCost๋Š” ๋ฐ”๋กœ ๋‹ค์‹œ ์ฝ์–ด์™€์•ผ ํ•˜๋Š”๋ฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์— ๊ณ„์‚ฐ๊ฐ’์„ ๋„ฃ์—ˆ๋‹ค๊ฐ€, ๋ฐ”๋กœ ๋‹ค์‹œ ์ฝ์–ด์˜ค๋Š” ๊ฒŒ ๊ดœ์ฐฎ์„๊นŒ? ๋ผ๋Š” ๊ณ ๋ฏผ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.

  • ๋ฒ ํŒ… ๊ธˆ์•ก์„ ๊ด€๋ฆฌํ•˜๋Š” ํด๋ž˜์Šค๋ฅผ ๋งŒ๋“ค๊ณ , ๊ณ„์‚ฐํ•˜๋Š” ์ฑ…์ž„๋„ ๊ด€๋ฆฌํ•˜๋Š” ํŽธ์ด ์ œ์ผ ๋‚˜์„๊นŒ์š”?

  • ์ด ๋ถ€๋ถ„์— ๋Œ€ํ•ด์„œ ์กฐ๊ธˆ ๋” ๊ณ ๋ฏผํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค!..


์ฑ…์„ ์ฝ์œผ๋ ค๊ณ  ํ•˜๋Š” ๋ชฉ์ ์ด ๋ฌด์—‡์ธ์ง€ ํ•œ ๋ฒˆ ์ƒ๊ฐํ•ด๋ณด์…”๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  • ์ฑ…์„ ์ฝ์œผ๋ ค๋Š” ์ด์œ ๋Š” ๋น„์œ ๋ฅผ ํ•˜์ž๋ฉด ์ด๋ ‡๊ฒŒ ๋А๊ปด์กŒ์Šต๋‹ˆ๋‹ค.
    ๊ฐ„์‹ ์—ฌ๋Ÿฌ๊ฐœ๋กœ ๋ฐฐ ์ฑ„์šฐ๋Š” ๊ฒƒ๋ณด๋‹ค ๋“ ๋“ ํ•œ ํ•œ ๋ผ ๋จน์ž! ๐Ÿ˜†
    ์•„์ง ์—ฌ๋Ÿฌ ๋ฐฉ๋ฒ•์œผ๋กœ ๊ณต๋ถ€ํ•ด๋ณธ ๊ฒƒ์€ ์•„๋‹ˆ์ง€๋งŒ, ๋ชจ๋ฅด๋Š” ๊ฒƒ์„ ์ธํ„ฐ๋„ท์œผ๋กœ ๊ฒ€์ƒ‰ํ•ด์„œ ๊ณต๋ถ€ํ•  ๋• ์ด์–ด์ง€์ง€ ์•Š๊ณ , ๋ถ€๋ถ„๋ถ€๋ถ„ ํŒŒํŽธํ™” ๋œ ๊ธฐ์–ต์œผ๋กœ ๋‚จ๋Š” ๊ฒƒ ๊ฐ™์•˜์–ด์š”. ์ฑ…์€ ์กฐ๊ธˆ ๋‹ฌ๋ž๊ฑฐ๋“ ์š”
    ๊ทธ๋ ‡์ง€๋งŒ ์ฑ…์€ ์ฝ๋Š” ๋ฐ ์†๋„๊ฐ€ ๋А๋ฆฐ๋งŒํผ ์ž˜ ์กฐ์ ˆํ•ด ๋ด์•ผ๊ฒ ์–ด์š”! ์•ฝ๊ฐ„์˜ ์™„๋…๋ณ‘(?)์ด ์žˆ์–ด์„œ ๋ถˆํ•„์š”ํ•œ ๋ถ€๋ถ„๋„ ์ฝ๊ฑฐ๋“ ์š”.
    ์•„์ง๊นŒ์ง„ ์ฑ…์œผ๋กœ ํ•™์Šต์ด ์ตœ๊ณ ์˜€์ง€๋งŒ, ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์„ ์šฐํ…Œ์ฝ” ๊ธฐ๊ฐ„์— ์‹œ๋„ํ•ด๋ณด๋ฉฐ ์žฅ๋‹จ์ ์„ ๋น„๊ตํ•˜๊ณ  ์ ์šฉํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค ๐Ÿ˜„

    ๋ธ”๋ž™์žญ ๋ฏธ์…˜์„ ๋๋‚ธ ๋’ค ์ฒ˜์Œ๋ถ€ํ„ฐ ๋‹ค์‹œ ๊ตฌํ˜„ํ•ด๋ณด๊ธฐ
    ์ง€๊ธˆ์€ ์ด๊ฒŒ ์ œ์ผ ํ•˜๊ณ ์‹ถ์–ด์š”!


ํ•ญ์ƒ ์ข‹์€ ํ”ผ๋“œ๋ฐฑ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ์ดˆ์ฝ”์นฉ! ๐Ÿ˜†

Copy link

@Chocochip101 Chocochip101 left a comment

Choose a reason for hiding this comment

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

์•ˆ๋…•ํ•˜์„ธ์š”, ์ด์•ˆ!
์‚ฌ์ดํด 1์˜ ํ”ผ๋“œ๋ฐฑ์„ ์ž˜ ์ˆ˜์ •ํ•ด์ฃผ์…จ๋„ค์š” ๐Ÿ‘๐Ÿป
๋ณ€๊ฒฝํ•ด์ฃผ์‹  ์ ๋“ค์— ๋Œ€ํ•ด ์ปค๋งจํŠธ๋กœ ํ”ผ๋“œ๋ฐฑ ๋‚จ๊ฒผ์œผ๋‹ˆ ํ™•์ธํ•ด์ฃผ์„ธ์š”!


import java.util.List;

public class NoShuffleStrategy implements ShuffleStrategy {

Choose a reason for hiding this comment

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

ํ…Œ์ŠคํŠธ์—์„œ๋งŒ ์“ฐ์ด๋Š”๋ฐ, ํ…Œ์ŠคํŠธ ํŒจํ‚ค์ง€๋กœ ์˜ฎ๊ฒจ๋ณด๋Š”๊ฑด ์–ด๋–จ๊นŒ์š”?

public class RandomShuffleStrategy implements ShuffleStrategy {

@Override
public void shuffle(List<Card> cards) {
Copy link

@Chocochip101 Chocochip101 Mar 14, 2026

Choose a reason for hiding this comment

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

์ธ์ž๋กœ ๋“ค์–ด์˜จ cards๊ฐ€ immutableํ•œ ์ž๋ฃŒํ˜•์ด๋ผ๋ฉด ์–ด๋–ค ์ผ์ด ๋ฐœ์ƒํ• ๊นŒ์š”? ๋˜ํ•œ ์›๋ณธ cards๊ฐ€ ์„ž์ด๊ณ  ๋‚œ ํ›„์— ๋ณ€๊ฒฝ์ด ์กด์žฌํ• ๊นŒ์š”? ๊ทธ๋ ‡์ง€ ์•Š๋‹ค๋ฉด ๋ฐฉ์–ด์  ๋ณต์‚ฌ๋กœ void๊ฐ€ ์•„๋‹Œ immutableํ•œ ๋žœ๋ค List<Card>๋ฅผ ๋ฐ˜ํ™˜ํ•ด๋„ ๋˜์ง€ ์•Š์„๊นŒ์š”?

return value.getFirst();
}

public int getUpgradeValue() {

Choose a reason for hiding this comment

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

์ˆœ์„œ๋กœ ACE์˜ ๊ฐ’์˜ 1 ๋˜๋Š” 11 ์—ฌ๋ถ€๋ฅผ ๊ฒฐ์ •ํ•˜๋„ค์š”. ๋งŒ์•ฝ ๋ˆ„๊ตฐ๊ฐ€๊ฐ€ ACE("A", List.of(11, 1)),๋กœ ๋ฐ”๊ฟ”์„œ ๋ฐฐํฌํ•˜๋ฉด ๋ฐ”๋กœ ์„œ๋น„์Šค์— ์žฅ์• ๊ฐ€ ๋‚ ์ˆ˜๋„ ์žˆ๊ฒ ๋„ค์š” ๐Ÿ˜จ

Choose a reason for hiding this comment

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

'Upgrade'๋ณด๋‹ค๋Š” isConvertibleTo ๊ฐ™์€ ๋ฉ”์„œ๋“œ ๋ช…์€ ์–ด๋– ์‹ ์ง€์š” ใ…Žใ…Ž


private boolean canPlusBonusScore(int sum) {
return containsAce() && sum + ACE_BONUS_SCORE <= MAX_SCORE;
public int quantity() {

Choose a reason for hiding this comment

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

๋ฉ”์„œ๋“œ๋Š” ๋™์‚ฌํ˜•์œผ๋กœ ๋ฐ”๊พธ๋Š”๊ฑด ์–ด๋–จ๊นŒ์š”?

Comment on lines +27 to +31
for (TrumpSuit suit : TrumpSuit.values()) {
for (TrumpNumber number : TrumpNumber.values()) {
cards.add(new Card(suit, number));
}
}

Choose a reason for hiding this comment

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

์ธ๋ดํŠธ๊ฐ€ 2๋„ค์š”. ๋ถ„๋ฆฌํ•ด๋ณผ๊นŒ์š”?

}

private void validateRange(int cost) {
if (cost > MAX_COST || cost < MIN_COST) {

Choose a reason for hiding this comment

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

์ €๋Š” Bigdecimal์ด๋‚˜ double๋กœ ์†Œ์ˆ˜์ ์„ ์ฑ™๊ธฐ๋Š” ๋ฐฉ์‹์œผ๋กœ ์ ‘๊ทผํ–ˆ๋Š”๋ฐ, ๋„๋ฉ”์ธ ์ œ์•ฝ์œผ๋กœ ํ•ด๊ฒฐํ•˜๋Š” ๊ฒƒ๋„ ํ›Œ๋ฅญํ•˜๋„ค์š” ๐Ÿ‘๐Ÿป ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋„ ์ข‹์Šต๋‹ˆ๋‹ค!

for (Map.Entry<String, WinStatus> playerWinStatus : playerGroups.getGameResult().entrySet()) {
String userName = playerWinStatus.getKey();
int userCost = (int) (userBetInfo.get(userName) * playerWinStatus.getValue().getEarningsRate());
int userCost = (int) (userBetInfo.get(userName).getCost() * playerWinStatus.getValue().getEarningsRate());

Choose a reason for hiding this comment

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

int ํ˜•๋ณ€ํ™˜ ๋•Œ๋ฌธ์— 100๋‹จ์œ„๋กœ ๋ฐ›๋Š”๋‹ค๋Š” ๊ฒƒ์„ ๋ชจ๋ฅด๋Š” ๋ˆ„๊ตฐ๊ฐ€๋Š” ์ด ์ฝ”๋“œ๋งŒ์„ ๋ณด๊ณ  ์˜คํ•ดํ•  ์ˆ˜๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”.

ํ•ด๋‹น ๋กœ์ง์„ ์„œ๋น„์Šค๊ฐ€ ์•„๋‹Œ ๋„๋ฉ”์ธ์œผ๋กœ ์˜ฎ๊ธธ ์ˆ˜ ์žˆ์„๊นŒ์š”? (int๋กœ 100๋‹จ์œ„๋กœ ๋‹ค๋ฃจ๊ธฐํ•œ๊ฒŒ ์ €ํฌ ๋„๋ฉ”์ธ ๊ทœ์น™์ด ๋˜์—ˆ์œผ๋‹ˆ๊นŒ์š”) ๊ธฐ์กด ๋„๋ฉ”์ธ์— ์˜ฎ๊ธฐ๊ธฐ ํž˜๋“ค๋‹ค๋ฉด ์ƒˆ๋กœ์šด ์ผ๊ธ‰ ์ปฌ๋ ‰์…˜ ๋งŒ๋“ค์–ด๋„ ๋˜๊ฒ ๋„ค์š”.

@@ -7,6 +7,7 @@

public class Participant {

Choose a reason for hiding this comment

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

ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์š”๊ตฌ ์‚ฌํ•ญ์ธ 3๊ฐœ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค ๋ณ€์ˆ˜๋ฅผ ๊ฐ€์ง„ ํด๋ž˜์Šค๋ฅผ ์“ฐ์ง€ ์•Š๋Š”๋‹ค. ๊ฐ€ ์•„๋‹ˆ์˜€๋‹ค๋ฉด participant๊ฐ€ ๊ด€๋ฆฌํ•˜๋„๋ก ํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค

๋งž์Šต๋‹ˆ๋‹ค. name, handCards, cost๋ฅผ ๋ชจ๋‘ ๋„ฃ์œผ๋ฉด 3๊ฐœ๊ฐ€ ๋˜์–ด ์ œ์•ฝ์„ ์–ด๊ธฐ๊ฒŒ ๋˜๋„ค์š”! ํ•˜์ง€๋งŒ ์ด ์ œ์•ฝ์˜ ํ•ต์‹ฌ ์˜๋„๋Š” '๋กœ์ง์„ ์„œ๋น„์Šค๋กœ ๋ฐ€์–ด๋‚ด๋ผ'๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, '๊ฐ์ฒด๋ฅผ ๋” ์ž‘๊ณ  ์˜๋ฏธ์žˆ๋Š” ๋‹จ์œ„๋กœ ์ชผ๊ฐœ๋ผ'๋Š” ๊ฒƒ์œผ๋กœ ์ดํ•ดํ•˜๊ณ  ์žˆ์–ด์š”.

์ €ํฌ๋Š” ์š”๊ตฌ์‚ฌํ•ญ์„ ๋งŒ์กฑํ•ด์•ผํ•˜๋‹ˆ, HandCards์™€ Cost๋ฅผ ๋ฌถ๋Š” ์ƒˆ๋กœ์šด ๊ฐ์ฒด(์˜ˆ: PlayerStatus)๋ฅผ ๋„์ž…ํ•œ๋‹ค๋ฉด, ๊ฐ ๊ฐ์ฒด๋Š” ๋ณ€์ˆ˜๋ฅผ 2๊ฐœ ์ดํ•˜๋กœ ์œ ์ง€ํ•˜๋ฉด์„œ๋„ '์ž์‹ ์˜ ์ˆ˜์ต์„ ์Šค์Šค๋กœ ๊ณ„์‚ฐํ•˜๋Š” ๋กœ์ง'์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๊ฒŒ ๋˜๊ฒ ๋„ค์š”!
์„œ๋น„์Šค๋Š” ๊ทธ์ € ์ด ๊ฐ์ฒด๋“ค์—๊ฒŒ ๋ฉ”์‹œ์ง€๋งŒ ๋˜์ง€๋ฉด ๋˜๊ณ ์š”. ์ด๋ ‡๊ฒŒ ๋ฆฌํŒฉํ† ๋งํ•ด๋ณด๋ฉด ์–ด๋–จ๊นŒ์š”?

public class Participant {

    private final Name name;
    private final PlayerStatus status;

    ...
}


public class PlayerStatus {
    private final HandCards handCards;
    private final Cost cost;

    public int calculateProfit(WinStatus winStatus) {
        ... // ์–ด๋–ค ์•„๋ฌด๊ฐœ ๋กœ์ง...
    }
}

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.

2 participants