Skip to content

Conversation

@jurlring
Copy link

안녕하세용!

이번에도 잘 부탁드립니다 :)
시간 나실 때 천천히 봐주세요!

Copy link

@ssonsh ssonsh left a comment

Choose a reason for hiding this comment

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

테스트 코드가 꼼꼼히 잘 작성된 것 같아요 :) 배우고 갑니다~!

코맨트는 한번 쓱 살펴봐주세요


interface Participant {
val name: String
var money: Int
Copy link

Choose a reason for hiding this comment

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

Player.kt 를 보면 money 는 배팅금액으로 활용되는 것 같은데

Dealer 에게는 배팅금액 개념은 없는 것으로 이해하고 있어서, 배팅금액은 Player 에게만 있으면 되는게 아닐까요??

Copy link
Author

Choose a reason for hiding this comment

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

Dealer도 수익 개념이 있기때문에 Participant에 money가 필요하다고 생각했습니다!

Comment on lines 30 to 41
while (true) {
if (isDrawCard()) {
player.cards.addCard(deck.drawCard())
printCards()
if (!player.isDrawAvailable()) {
break
}
} else {
break
}
}
}
Copy link

Choose a reason for hiding this comment

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

이 부분에서 조건문이 중첩되고 else / break 가 들어가면서 오히려 복잡해보일 수 있을 것 같아요 !

줄일 수 있는 방법은 없을까요??

while(true) 로 loop 도는 것 보다 while (player.isDrawAvailable() && isDrawCard()) 와 같은 조건일 때 처리를 할 수도 있을 것 같아요

dealer: Dealer,
player: Player,
): Double {
if (player.getCardSize() > INITIAL_DRAW_CARD_SIZE && player.isBust()) return -1.0
Copy link

Choose a reason for hiding this comment

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

isBust 이면 getCardSize() 가 INITIAL_DRAW_CARD_SIZE 보다 큰 것과 상관 없이 패배이지 않나요??

뭔가 굳이 getCardSize() > INITIAL_DRAW_CARD_SIZE 를 안줘도 될 것 같다는 생각이 들었어요

제가 잘못이해한 부분이 있다면 말씀주시면 감사하겠습니다 ㅎㅎ

Copy link
Author

Choose a reason for hiding this comment

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

추가 카드를 받아야 bust가 되니까 player.getCardSize() > INITIAL_DRAW_CARD_SIZE 조건은 없어도 될 것 같네요!
단, 카드를 추가로 뽑아 21을 초과할 경우 배팅 금액을 모두 잃게 된다. 요 정책을 코드로 옮기는데, 리터럴리 그대로 옮긴 것 같네용 감사합니다!

if (isBothBlackJack(dealer, player)) return 1.0
if (player.isPlayerBlackJack()) return 1.5
if (dealer.getScore() < player.getScore()) return 1.0
return -1.0
Copy link

Choose a reason for hiding this comment

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

동점인 경우엔 -1.0 패배 처리가 되는데 의도한게 아니라면 동점에 대한 처리가 필요하겠네요!

저는 동점 케이스를 안본 것 같긴하네요.. ㅎ

Copy link
Author

Choose a reason for hiding this comment

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

블랙잭 룰을 어떻게 정의하냐에 따라 다른것 같은데, 저도 다시 찾아보니 무승부는 없더라구용??
그래서 동점인 경우 딜러 승으로 정책 세워보았습니다 ㅎㅎ

Comment on lines +35 to +47
"딜러 돈 추가" {
val dealer = Dealer()
dealer.minusMoney(1000)

dealer.money shouldBe -1000
}

"딜러 돈 차감" {
val dealer = Dealer()
dealer.minusMoney(-1000)

dealer.money shouldBe 1000
}
Copy link

Choose a reason for hiding this comment

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

음.. 여기에서 딜러 돈이라는 것은 Dealer 의 money 이고 이건 수익금을 의미하고 있는거겠죠..?!

배팅금액과 수익금은 다르게도 볼 수 있을 것 같은데 한번 고려해봐주셔도 좋을 것 같고

현재를 유지하셔도 무방할 것 같습니다 ㅎ

Copy link
Author

Choose a reason for hiding this comment

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

저는 배팅금액이 수익금이라고 생각하고 구현했습니다!ㅎㅎ
결국에 같은 값을 가져가게 되어서 동일하게 보았는데, 플레이어의 수익은 2배로 한다 뭐 이런 정책이 생기면 나눠서 볼 수 있을 것 같습니다!

Copy link

Choose a reason for hiding this comment

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

네네 이해했습니다 ㅎ

제가 바라보는 금액은 2가지 형태라 위와 같이 코맨트 드렸던 것 같습니다! 고생많으셨어요 :)

Comment on lines +11 to 17

fun isBust(): Boolean = cards.isBust()

fun isBlackJack(): Boolean = cards.isBlackJack()

fun getScore(): Int = cards.calculateScore()
}
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 +26 to +27
OutputView.printRoundResult(players, dealer)
OutputView.printFinalResult(dealer, players)
Copy link

Choose a reason for hiding this comment

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

의도가 있다면 패스해주셔도 됩니다!

어떤 메소드에선 players 를 먼저, 어떤 메소드에선 dealer 를 먼저 받고 있는데 뭔가 내부적인 룰이 있는지 궁금합니다.

(저도 비슷했던 것 같은데 보다가 보니 문득 궁금해졌네요!)

Copy link
Author

Choose a reason for hiding this comment

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

print 메서드에서 먼저 사용하는 순서로 파라미터를 구성해서 그렇음다!

Copy link

Choose a reason for hiding this comment

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

별다른 사유는 없는것으로! ㅎㅎ

@ssonsh ssonsh merged commit 73f2640 into next-step:jurlring Dec 31, 2025
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