-
Notifications
You must be signed in to change notification settings - Fork 389
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
[1단계 - 블랙잭] 후디(조동현) 미션 제출합니다. #273
Merged
Merged
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
e01a4c9
docs(README): 연료 주입 기능 요구 사항 작성
devHudi 324ecf6
feat(Sonata): Sonata 도메인 구현
devHudi 931eaac
feat(RentCompany): RentCompany 도메인 구현
devHudi b97bf3c
feat(Car): Car 인터페이스 구현
devHudi e71798b
feat(Car): K5, Avante 구현체 구현
devHudi cd43054
refactor(test): Car 구현체별 Nested 어노테이션 적용
devHudi 4707528
feat(RentCompany): Sonata 대신 Car 인터페이스로 대체
devHudi c1dc425
docs(README): 블랙잭 기능 요구사항 및 카드 도메인 정보 작성
devHudi fe7afe9
feat(CardSymbol): CardSymbol 도메인 구현
devHudi 1f907b7
feat(CardRank): CardRank 도메인 구현
devHudi 75575b9
feat(Card): Card 도메인 구현
devHudi 4b8e7e1
feat(CardDeck): CardDeck 도메인 구현
devHudi 764b6a7
feat(Score): Score 도메인 구현
devHudi dffb069
feat(CardRank): value 필드 추가
devHudi 1ea196a
feat(CardBundle): CardBundle 도메인 구현
devHudi 0545635
feat(ResultType): ResultType 도메인 구현
devHudi 09f892a
feat(ResultCount): ResultCount 도메인(VO) 구현
devHudi c927f13
feat(ResultStatistics): ResultStatistics 도메인(일급컬렉션) 구현
devHudi f7e6efb
feat(Player): Player 도메인 구현
devHudi 5622f96
feat(Dealer): Dealer 도메인 구현
devHudi 985cbdd
feat(CardStack): CardStack 인터페이스 명세 작성
devHudi 9328cf9
refactor(test): CardRepository
devHudi bd7ddbd
test(CardStackGenerator): CardDeck에 대한 테스트 더블 생성 기능 셋업
devHudi 06eb952
feat(BlackjackGame): BlackjackGame 도메인 구현
devHudi f615b8f
docs(README): 블랙잭 기능 구현 목록 및 카드 도메인 정보 수정
devHudi eb32dab
feat(BlackjackGame): 생성자의 파라미터를 가변인자 대신 문자열 리스트를 받도록 수정
devHudi 97b24f4
feat(blackjack): 사용자로부터 플레이어명을 입력받아 게임 인스턴스 생성
devHudi 811ad7f
feat(Card): 카드 이름 반환
devHudi 4e89d1a
feat(OutputView): 딜러와 플레이어의 초기 카드 정보 출력 기능 구현
devHudi 8260441
feat(InputView): 카드 추가 지급 여부를 입력받는 기능 구현
devHudi d4cce17
feat(controller): 단일 플레이어가 카드를 더 뽑는 로직 구현
devHudi 2a3434e
feat(OutputView): 플레이어의 점수가 21을 초과하는 경우 메세지 출력
devHudi a6df12a
feat(blackjack): 딜러의 점수에 따라 한장을 더 지급
devHudi a69bb6e
feat(participant): Player, Dealer 도메인 수정
devHudi d842bbc
feat(participant): Participant 추상클래스 구현
devHudi 9463264
feat(OutputView): 카드 지급 완료 후 딜러와 플레이어의 카드와 점수를 공개하는 기능 구현
devHudi 0d69dbe
feat(blackjack): 딜러와 모든 플레이어의 최종 승패 결과 출력 기능 구현
devHudi 2d828f3
docs(README): 기능 구현 목록 수정
devHudi d9cd943
feat(CardRank): ACE의 기본 값을 11로 수정
devHudi c5050b1
refactor(constant): Score 관련 상수들을 Score 클래스로 이동
devHudi 965fbb1
feat(CardBundle): 점수가 21을 넘을 경우 ACE 를 1로 취급하도록 getScore 메서드 로직 수정
devHudi cfb7521
feat(view): 출력되는 메시지 수정
devHudi 2ef4d98
feat(controller): 딜러가 버스트한 경우 모든 플레이어가 승리하도록 finishGame 메서드 수정
devHudi d402b96
feat(controller): finishGame 메서드에 플레이어 버스트에 따른 로직 추가
devHudi 1c017f5
feat(Participant): 서로 다른 Participant 끼리 점수를 비교하는 기능 구현
devHudi ef20c90
feat(Referee): Player 와 Dealer 의 승부 결과를 반환하는 Referee 구현
devHudi 722b6b9
feat(MatchDto): 승패무 결과를 가지고 있는 DealerMatchDto와 PlayerMatchDto 구현
devHudi b6d2d66
fix(Participant): 참여자가 버스트 되었을 때 패배하도록 수정
devHudi 8eaa3a3
refactor(dto): dto 패키지를 blackjack 패키지 하위로 이동
devHudi 67229b1
refactor(dto): 카드 패 및 점수 출력 로직을 Dto 를 사용하여 개선
devHudi 13f9ab7
refactor(controller): Application 의 로직을 BlackjackController 로 위임
devHudi 42de1c2
refactor(CardBundle): CardBundle 클래스명을 Hand 로 변경
devHudi 9dc1a9f
refactor(Dealer): 사용되지 않는 getOpenCard 메소드 제거
devHudi 95b7170
refactor(Score): 크기 비교 메소드 isGreaterThan, isGreaterOrEqualThan, isLes…
devHudi b9386f0
refactor(Score, ResultCount): toInt 메소드를 getValue 로 이름 변경
devHudi b6d32d3
refactor(ResultStatistics): 사용되지 않는 클래스 제거
devHudi eba01ec
refactor(Participant): hand 필드에 final 추가
devHudi cabdc5d
fix(Participant): 플레이어가 버스트되어도 승으로 표시되는 오류 수정
devHudi 9eaa5c4
refactor(blackjack): getter 호출 시 방어적 복사하여 반환하도록 개선
devHudi 303e43b
fix(Score): isLessOrEqualThan 부등호 수정
devHudi 072ebea
fix(BlackjackGame): 딜러의 점수가 16이하일 경우 17이상이 될 때까지 카드를 반복하여 가져가도록 로직 수정
devHudi 4d1be5b
refactor(Participant): name 과 hand 필드의 접근제어자를 protected 에서 private 로 변경
devHudi fd9a8b2
fix(Hand): ACE 가 포함된 패의 점수가 잘 못 계산되는 로직 해결
devHudi 67ed69a
refactor(BlackjackGame): BlackjackGame에 Player에게 카드를 주는 메소드 (giveExtr…
devHudi c794038
feat(BlackjackController): 카드 추가지급에 대한 입력이 y, n 이 아닐경우 재입력 받도록 개선
devHudi 51438f7
feat(Player): 공백의 이름을 전달받은 경우 예외 발생
devHudi 1bc3dbe
feat(BlackjackGame): 중복된 플레이어 이름 입력 시 예외 발생
devHudi d2413c5
refactor(BlackjackController): 게임의 초기값 출력 메소드 추출
devHudi a2920ae
refactor(BlackjackController): participants 필드를 players 로 이름 변경
devHudi bc592ef
refactor(CardStackGenerator): CardStackImpl 을 CardStackStub 으로 이름 변경
devHudi 2cfc90c
refactor(Referee): 메소드 순서 변경
devHudi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
16 changes: 8 additions & 8 deletions
16
src/main/java/blackjack/domain/participant/Participant.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
package blackjack.domain.participant; | ||
|
||
import blackjack.domain.card.Card; | ||
import blackjack.domain.card.CardBundle; | ||
import blackjack.domain.card.Hand; | ||
import blackjack.domain.game.ResultType; | ||
import blackjack.domain.game.Score; | ||
|
||
public abstract class Participant { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 감사해요 😀 |
||
|
||
protected final String name; | ||
protected CardBundle cardBundle; | ||
protected Hand hand; | ||
|
||
protected Participant(final String name, final CardBundle cardBundle) { | ||
protected Participant(final String name, final Hand hand) { | ||
this.name = name; | ||
this.cardBundle = cardBundle; | ||
this.hand = hand; | ||
} | ||
|
||
public abstract void receiveCard(Card card); | ||
|
||
public abstract boolean canReceive(); | ||
|
||
public Score getCurrentScore() { | ||
return cardBundle.getScore(); | ||
return hand.getScore(); | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public CardBundle getCardBundle() { | ||
return cardBundle; | ||
public Hand getHand() { | ||
return hand; | ||
} | ||
|
||
public boolean isBusted() { | ||
return cardBundle.getScore().toInt() > Score.BLACKJACK; | ||
return hand.getScore().toInt() > Score.BLACKJACK; | ||
} | ||
|
||
public ResultType compareWith(Participant other) { | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
package blackjack.domain.participant; | ||
|
||
import blackjack.domain.card.Card; | ||
import blackjack.domain.card.CardBundle; | ||
import blackjack.domain.card.Hand; | ||
import blackjack.domain.game.Score; | ||
|
||
public class Player extends Participant { | ||
|
||
private Player(final String name, final CardBundle cardBundle) { | ||
super(name, cardBundle); | ||
private Player(final String name, final Hand hand) { | ||
super(name, hand); | ||
} | ||
|
||
public static Player of(final String name, final CardBundle cardBundle) { | ||
return new Player(name, cardBundle); | ||
public static Player of(final String name, final Hand hand) { | ||
return new Player(name, hand); | ||
} | ||
|
||
public void receiveCard(Card card) { | ||
cardBundle.add(card); | ||
hand.add(card); | ||
} | ||
|
||
public boolean canReceive() { | ||
Score score = cardBundle.getScore(); | ||
Score score = hand.getScore(); | ||
return score.toInt() <= Score.BLACKJACK; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Player{" + | ||
"name='" + name + '\'' + | ||
", cardBundle=" + cardBundle + | ||
", hand=" + hand + | ||
'}'; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
카드의 순서가 중요할 것 같은데, Set자료구조로 괜찮을까요? 🤔
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.
확인해보니 새로운 카드를 플레이에 추가할 때 마다 순서가 다르게 표시되네요! List 자료구조로 개선하였습니다 :)