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

2단계 - 블랙잭 #682

Open
wants to merge 10 commits into
base: hyotaek-jang
Choose a base branch
from
Open

Conversation

HyoTaek-Jang
Copy link

안녕하세요, 장효택입니다.

2단계 미션 블랙잭 구현 완료했습니다.

개인적으로 BlackJackController와 BlackJackGame 간의 역할과 책임을 나누는게 어렵네요

이번 리뷰 잘 부탁드리겠습니다.

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.

블랙잭 미션 구현 잘해주셨습니다 👍
깔끔하게 구현해주셔서 크게 코멘트 드릴 부분은 없었던것 같아요 😄
몇가지 생각거리만 남겨두었는데 확인 부탁드립니다 !

const val MAX_SCORE = 21
private const val ADDITIONAL_ACE_SCORE = 10

fun score(cards: CardList): Int {
Copy link

Choose a reason for hiding this comment

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

코멘트 남겨주신것 처럼 BlackJackGame의 책임이 모호한거 같아요 😄
플레이어가 뽑은 카드의 점수를 계산하는 책임을 부여 해주셨는데 개인적으로는 CardList 일급 컬렉션이 해당 기능을 제공하는것이 자연스러운 모델링이 될수 있을것 같은데 검토 부탁드려요 😄

cards.addCard(newCards)
}

fun canDraw(): Boolean {
Copy link

Choose a reason for hiding this comment

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

플레이어가 카드를 뽑지 못하는 상황은 뽑은 카드의 합이 21이 넘었을 경우와 스스로 카드를 그만 받는다고 선언한 상태가 존재합니다.
외부 요인(input value)에 의존하지 않고 스스로 상태를 나타내보는건 어떨까요 ?

import blackjack.domain.BlackJackGame.MAX_SCORE
import blackjack.domain.BlackJackGame.score

class Player(val name: String, val cards: CardList = CardList()) {
Copy link

Choose a reason for hiding this comment

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

CardList라는 네이밍도 좋지만 플레이어가 뽑은 카드를 직관적으로 나타낼수 있는 네이밍을 고민해보는건 어떨까요 ?

Comment on lines +11 to +13
fun addCard(newCards: List<Card>) {
cards.addCard(newCards)
}
Copy link

Choose a reason for hiding this comment

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

플레이어가 카드를 복수로 뽑는 행위는 현재 처음 카드를 받는 상황만 존재할것 같아요. addCard 보단 블랙잭 게임을 시작하는것을 나타내보는건 어떨까요 ?

import blackjack.domain.BlackJackGame.score

class Player(val name: String, val cards: CardList = CardList()) {
fun addCard(newCard: Card) {
Copy link

Choose a reason for hiding this comment

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

참가자가 카드를 추가하는것도 좋지만 카드를 뽑는 행위를 제공하는것도 좋을것 같아요 😄

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