-
Notifications
You must be signed in to change notification settings - Fork 313
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
base: yoonnyeong
Are you sure you want to change the base?
step4: 블랙잭(베팅) #700
Conversation
There was a problem hiding this 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)) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
외부에서 값을 바꿀수 없도록 가시성을 제한해주세요.
for (resultMap in resultMapList) { | ||
for ((player, matchResult) in resultMap) { | ||
val profit = matchResult.rate * player.bettingAmount | ||
player.profit = profit | ||
dealer.calculateProfit(profit.toInt()) | ||
} | ||
} |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
프로퍼티를 get해서 사용하지 말고 메세지를 주고받도록 해주시면 좋을것 같습니다.
4단계 베팅 기능 추가하였습니다!