Skip to content
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

step4: 블랙잭(베팅) #700

Open
wants to merge 1 commit into
base: yoonnyeong
Choose a base branch
from

Conversation

yoonnyeong
Copy link

4단계 베팅 기능 추가하였습니다!

Copy link

@pci2676 pci2676 left a comment

Choose a reason for hiding this comment

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

개설할만한 부분에 리뷰를 남겨두었습니다.

확인 부탁드립니다.

ResultView.showPlayerCards(player)
}

for (player in players) {
while (InputView.askPlayer(player.name) && !player.isBusted) {
while (!player.isBusted && InputView.askPlayer(player.name)) {
Copy link

Choose a reason for hiding this comment

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

private var _cards = Cards(mutableListOf())

var profit = 0.0
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 +16 to +22
for (resultMap in resultMapList) {
for ((player, matchResult) in resultMap) {
val profit = matchResult.rate * player.bettingAmount
player.profit = profit
dealer.calculateProfit(profit.toInt())
}
}
Copy link

Choose a reason for hiding this comment

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

depth가 2가 넘는것 같습니다.

객체의 값을 외부에서 set할수 없도록 하고 메세지를 던지도록 변경해주시면 좋을것 같습니다.

@@ -1,10 +1,10 @@
package blackjack.domain

abstract class BlackjackParticipant(val name: String) {
abstract class BlackjackParticipant(val name: String, var bettingAmount: Int = 0) {
Copy link

Choose a reason for hiding this comment

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

bettingAmount도 외부에서 변경할 수 없도록 변경해주세요.


for (resultMap in resultMapList) {
for ((player, matchResult) in resultMap) {
val profit = matchResult.rate * player.bettingAmount
Copy link

Choose a reason for hiding this comment

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

프로퍼티를 get해서 사용하지 말고 메세지를 주고받도록 해주시면 좋을것 같습니다.

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.

None yet

2 participants