Conversation
- caculate 접두사로 변경
- 어떻게 구현할 것인지 전체적인 윤곽잡기
- 플레이어 리스트를 관리 - 정적 팩토리 메서드로 생성 - 카드 한꺼번에 뽑는 메서드 구현 - Game 안에 관련로직 수정
- Participant 클래스 상속받음 - 카드를 뽑는 메서드 오버라이딩
- 카드 1장에 대한 정보를 관리하는 Card 클래스 - 모든 카드 묶음을 관리하는 Deck 클래스
- Game 클래스를 controller 패키지로 이동
- 덱을 미리 섞어서 반환
- 카드 안전하게 반환 - 점수계산 메서드 리펙터링
- 덱 생성 - 참가자 초기화 - 현재 참가자 상태 저장
- 변경된 클래스에 맞게 코드 수정
- CardType enum에 이름 설정 - Card 정보를 반환하는 toString() 메서드 구현
- 처음 2장씩뽑는경우, 1장씩 뽑는경우 나눠서 메서드 구현 - 정보를 반환하는 메서드 구현 - 승점을 계산하는 메서드 구현
- 사용자 입력 메서드 구현
- 출력 하는 메서드 구현
joswlv
requested changes
Feb 21, 2022
joswlv
left a comment
There was a problem hiding this comment.
안녕하세요 승진님!
몇 가지 코멘트를 남겼습니다.
블랙잭 요구사항과 코멘트를 확인 부탁드립니다.
|
|
||
| @Override | ||
| public void drawCardContinue(Deck deck) { | ||
| System.out.println(name + "는 한장의 카드를 더 받겠습니까?(예는 y, 아니오는 n)"); |
|
|
||
| @Override | ||
| public void drawCardMultiple(Deck deck, int number) { | ||
| cards.addCards(deck.drawMultiple(number)); |
There was a problem hiding this comment.
21점이상 되면 카드를 더 받을 수 없는 조건이 추가 되어야 할 것 같습니다.
| } | ||
|
|
||
| @Override | ||
| public void drawCardContinue(Deck deck) { |
There was a problem hiding this comment.
Suggested change
| public void drawCardContinue(Deck deck) { | |
| public boolean drawCardContinue(Deck deck) { |
이렇게 수정해 컨트롤러에 메시지를 던지는 방식으로 수정해보는 것은 어떨까요?
그리고 21점이 넘으면 카드를 받을 수 없는 조건이 빠져있습니다.
| if (cards.sumCardScore() > 17) { | ||
| return; | ||
| } | ||
| System.out.println("딜러는 16이하라 한장의 카드를 더 받았습니다."); |
| return new Deck(types, values); | ||
| } | ||
|
|
||
| public List<Card> drawMultiple(int num) { |
There was a problem hiding this comment.
매번 카드를 생성해서 리턴하는 것보다 덱에서 카드를 뽑아 전달하는 방식으로 수정해 보는 것은 어떨까요?
실제 블랙잭 게임에서 52장의 Card를 덱으로 만들어 딜러와 플레이어에게 전달하는 방식으로 게임을 운영하는 것을 생각해 보면 구현에 도움이 될 것 같습니다.
| return cards.sumCardScore(); | ||
| } | ||
|
|
||
| public abstract void drawCardMultiple(Deck deck, int number); |
There was a problem hiding this comment.
Suggested change
| public abstract void drawCardMultiple(Deck deck, int number); | |
| public abstract void drawCardMultiple(Deck deck); |
메서드 이름에서 행위가 표현됩니다. 굳이 카드 숫자를 받아 처리할 필요가 없을 것 같습니다.
| } | ||
|
|
||
| public final String holdingInfo() { | ||
| return name + COLON + cards.toString(); |
| import java.util.Collections; | ||
| import java.util.List; | ||
|
|
||
| public class ParticipantCards { |
There was a problem hiding this comment.
참가자의 카드 점수에 따른 상태값을 가지도록 수정해보는 것은 어떨까요?
| if (InputView.isContinue()) { | ||
| cards.addCards(deck.drawMultiple(1)); | ||
| System.out.println(holdingInfo()); | ||
| drawCardContinue(deck); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

연료 주입, 블랙잭 (Step1) 미션 제출합니다.