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

Step3: 블랙잭(딜러) #677

Open
wants to merge 15 commits into
base: wilgur513
Choose a base branch
from
Open

Step3: 블랙잭(딜러) #677

wants to merge 15 commits into from

Conversation

verus-j
Copy link

@verus-j verus-j commented Nov 28, 2023

안녕하세요~ 리뷰어님 딜러까지 구현했습니다 ㅎㅎ
Participant 추상 클래스를 만들어서 중복 로직을 제거습니다!

Copy link

@sah3122 sah3122 left a 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() {
Copy link

Choose a reason for hiding this comment

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

main 함수가 너무 많은 책임을 가지고 있는것 같습니다.
블랙잭 게임을 진행하기 위한 클래스를 정의해보는건 어떨까요 ?

Copy link
Author

Choose a reason for hiding this comment

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

Blackjack 클래스 추출했습니다.

Comment on lines +9 to +10
override fun isObtainable(): Boolean {
return sumOfCards() < BLACKJACK_SCORE
Copy link

Choose a reason for hiding this comment

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

플레이어는 더이상 카드를 받지 않지 않는 선언을 할수 있습니다.
input의 값으로 넘기기 보단 플레이어의 상태값을 추가해보는것을 도전해보세요 😄

Comment on lines +10 to +11
val hands
get() = cards.values
Copy link

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>
Copy link

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(
Copy link

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,
Copy link

Choose a reason for hiding this comment

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

참가자 클래스가 카드덱을 들고있는 모델링이 적합한지 고민해보시면 좋을것 같아요.
블랙잭 참가자는 카드덱을 가지고 있다.

Copy link
Author

Choose a reason for hiding this comment

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

Card를 받도록 수정했습니다

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