-
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
Step3: 블랙잭(딜러) #677
base: wilgur513
Are you sure you want to change the base?
Step3: 블랙잭(딜러) #677
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.
딜러 미션 구현 잘해주셨습니다 👍
깔끔한 코드로 구현해주셔서 구현적인 측면보단 몇가지 고민거리를 남겨두었는데 확인 부탁드려요 🙏
@@ -1,26 +1,55 @@ | |||
package blackjack | |||
|
|||
import blackjack.domain.Dealer | |||
import blackjack.domain.ShuffledCardDeck | |||
import blackjack.domain.Player | |||
import blackjack.view.InputView | |||
import blackjack.view.OutputView | |||
|
|||
fun main() { |
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.
main 함수가 너무 많은 책임을 가지고 있는것 같습니다.
블랙잭 게임을 진행하기 위한 클래스를 정의해보는건 어떨까요 ?
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.
Blackjack 클래스 추출했습니다.
override fun isObtainable(): Boolean { | ||
return sumOfCards() < BLACKJACK_SCORE |
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.
플레이어는 더이상 카드를 받지 않지 않는 선언을 할수 있습니다.
input의 값으로 넘기기 보단 플레이어의 상태값을 추가해보는것을 도전해보세요 😄
val hands | ||
get() = cards.values |
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.
hands 추가 👍
private val cardDeck: CardDeck, | ||
) { | ||
private val cards = Cards(cardDeck.next(), cardDeck.next()) | ||
abstract val openedCards: List<Card> |
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.
openedCards 를 상태값으로 가지는것도 좋지만 반드시 가지고 있어야 하는것은 아닐것 같아요.
딜러와 참가자간의 오픈 카드룰을 정의하여 함수로 제공하는건 어떨까요 ?
@@ -0,0 +1,27 @@ | |||
package blackjack.domain | |||
|
|||
abstract class Participant( |
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.
Participant 정의 👍
|
||
abstract class Participant( | ||
val name: String, | ||
private val cardDeck: CardDeck, |
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.
참가자 클래스가 카드덱을 들고있는 모델링이 적합한지 고민해보시면 좋을것 같아요.
블랙잭 참가자는 카드덱을 가지고 있다.
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.
Card를 받도록 수정했습니다
안녕하세요~ 리뷰어님 딜러까지 구현했습니다 ㅎㅎ
Participant 추상 클래스를 만들어서 중복 로직을 제거습니다!