-
Notifications
You must be signed in to change notification settings - Fork 75
[유양우] 연료주입, 블랙잭 - Step1 #25
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
base: yuyangwoo
Are you sure you want to change the base?
Conversation
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. RentCompany create 메서드 구현 2. 자동차를 추가하는 addCar 메서드 구현 3. 차량별로 주입해야 할 연료를 가진 generateReport 메서드 구현 Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. 스페이드, 하트, 다이아몬드, 클로버 Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. 카드를 생성하는 테스트 코드 구현 Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. 초기에 카드는 섞여서 2개가 주어진다. Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. 카드를 제공받고 중복 삭제를 위해 2개를 지워준다. Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonyeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonyeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonyeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonyeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonyeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. MatchResult enum class 생성으로 매치 결과를 계산하게끔 구현 2. MatchResultBoard player와 dealer의 결과를 가지는 map 클래스 구현 3. 플레이어와 딜러의 score를 가지는 클래스 구현 4. 코드 리팩토링에 따른 메소드 추가 및 리팩토링 Co-authored-by: seungyeonyeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonyeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonyeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonyeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. 카드의 합을 계산하는 로직 2. card와 이름을 super를 사용해 Gamer에서 초기화 Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. isBlackJack 코드 위임 2. isBust 코드 위임 Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. 모든_게이머는_처음에_2장의_카드를_받는다 2. 플레이어의_카드_총합을_계산한다 3. ACE는_1이나_11로_계산될_수_있다 4. 플레이어는_카드를_한_장더_받을_수_있다 Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. 카드의_총합이_21이면_블랙잭이다 2. 카드의_총합이_21을_넘으면_버스트이다 Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. 플레이어가_딜러랑_카드합이_같으면_무승부다 2. 플레이어가_딜러보다_카드합이_크면_승리한다 3. 플레이어가_딜러보다_카드합이_작으면_패배한다 Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
1. 초기에_카드는_섞여서_2개가_주어진다() 2. 두_카드의_합이_16_이하일_경우_카드를_추가로_한장_받는다() 3. 두_카드의_합이_16_초과일_경우_카드를_추가로_받지_않는다() Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
Co-authored-by: seungyeonjeong <crowsy@naver.com> Co-authored-by: YuYangWoo <yuyw0712@naver.com>
joswlv
left a comment
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.
안녕하세요 양우님!
몇 가지 코멘트를 남겼습니다.
확인 부탁드립니다.
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
| Card card = (Card) o; | ||
| return denomination == card.denomination && suit == card.suit; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(denomination, suit); | ||
| } | ||
|
|
||
| public Denomination getDenomination() { | ||
| return denomination; | ||
| } | ||
|
|
||
| public Suit getSuit() { | ||
| return suit; | ||
| } |
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.
| @Override | |
| public boolean equals(Object o) { | |
| if (this == o) { | |
| return true; | |
| } | |
| if (o == null || getClass() != o.getClass()) { | |
| return false; | |
| } | |
| Card card = (Card) o; | |
| return denomination == card.denomination && suit == card.suit; | |
| } | |
| @Override | |
| public int hashCode() { | |
| return Objects.hash(denomination, suit); | |
| } | |
| public Denomination getDenomination() { | |
| return denomination; | |
| } | |
| public Suit getSuit() { | |
| return suit; | |
| } | |
| public Denomination getDenomination() { | |
| return denomination; | |
| } | |
| public Suit getSuit() { | |
| return suit; | |
| } | |
| @Override | |
| public boolean equals(Object o) { | |
| if (this == o) { | |
| return true; | |
| } | |
| if (o == null || getClass() != o.getClass()) { | |
| return false; | |
| } | |
| Card card = (Card) o; | |
| return denomination == card.denomination && suit == card.suit; | |
| } | |
| @Override | |
| public int hashCode() { | |
| return Objects.hash(denomination, suit); | |
| } |
코드 컨벤션을 지켜주세요~
| @@ -0,0 +1,39 @@ | |||
| package blackjack.domain.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.
package dir name이 Card로 되어 있습니다. 소문자로 생성 부탁드립니다.
|
|
||
| private static final int DEALER_SUM_LIMIT = 16; | ||
| public Dealer() { | ||
| super("딜러"); |
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.
| super("딜러"); | |
| super(DEALER_NAME); |
상수로 변경해보는 것은 어떨까요?
|
|
||
| import java.util.Objects; | ||
|
|
||
| public class 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.
카드는 고정적인 값이라 매번 생성되는 것보다 static 하게 만들어 보는 것은 어떨까요?
|
|
||
| } | ||
|
|
||
| private void getCardOrNot(Gamer player) { |
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 void getCardOrNot(Gamer player) { | |
| private void drawTo(Gamer player) { |
의미를 명확하게 만들어보는 것은 어떨까요?
| if (dealer.getCardOrNot(dealer)) { | ||
| OutputView.printDealerAddCard(); | ||
| } |
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.
| if (dealer.getCardOrNot(dealer)) { | |
| OutputView.printDealerAddCard(); | |
| } | |
| drawToDealer() |
로직을 분리해보는 것은 어떨까요?
| static { | ||
| for(Denomination denomination : Denomination.values()) { | ||
| for(Suit suit : Suit.values()) { | ||
| cardList.add(new Card(denomination, suit)); | ||
| } | ||
| } | ||
| } |
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.
만약 게임이 계속 진행되어 Cads가 생성되어야 하는 경우 에러가 발생할 것으로 예상됩니다.
카드 뭉치를 정적으로 만드는 것보다 카드를 정적으로 만들어보는 것은 어떨까요?
안녕하세요 리뷰어님 !
연료주입과 블랙잭 미션 구현하였습니다.
리뷰 잘 부탁드립니다!
감사합니다