[π μ¬μ΄ν΄2 - λ―Έμ (λΈλμ λ² ν )] μλ² λ―Έμ μ μΆν©λλ€.#1102
[π μ¬μ΄ν΄2 - λ―Έμ
(λΈλμ λ² ν
)] μλ² λ―Έμ
μ μΆν©λλ€.#1102pci2676 merged 101 commits intowoowacourse:chocoding1from
Conversation
pci2676
left a comment
There was a problem hiding this comment.
μ 체μ μΌλ‘ 리뷰 λ°μμ΄ κΉλνμλ€μ
dmμΌλ‘ μ΄μΌκΈ°λ₯Ό λ§μ΄ν΄μ κ·Έλ°μ§ μ½λμμ κ³ λ―Όμ νμ μ΄ μ 보μ΄λκ² κ°λ€μ π
λμ ν΄λ³΄λ©΄ μ’μ λΆλΆμ 리뷰λ₯Ό λ¨κ²¨λμμΌλ νμΈν΄μ£ΌμΈμ
| public GameResult judge(User user) { | ||
| if (this.isBust() || user.isBust()) { | ||
| return judgeByBust(); | ||
| } | ||
|
|
||
| if (this.isBlackjack() || user.isBlackjack()) { | ||
| return judgeByBlackjack(user); | ||
| } | ||
|
|
||
| return judgeByScore(user); | ||
| } |
There was a problem hiding this comment.
μ΄ λΆλΆ λ‘μ§μ΄ μ무λλ 볡μ‘νλ€ λ³΄λ private λ©μλ νΈμΆμ λ§μ΄ νκ³ μλλ°μ
μνν¨ν΄μ μ΄μ©ν΄μ handλ₯Ό ννν΄λ³΄λ©΄ μ΄λ¨κΉμ? μ ν΄λ³Έλ€λ©΄ μ‘°κΈ λ κ°κ²°νκ² ννν΄λ³Ό μ μμκ² κ°μμ
| cardProvider.provideInitCards(users); | ||
| } | ||
|
|
||
| public void hitPlayers(List<User> users, Function<User, String> readHitCommand, |
There was a problem hiding this comment.
κ΅³μ΄ λ°μμ νμμ§ μμλ λλλ°μ
μμ κ°μ λΆλΆμμ λ§€κ°λ³μκ° λ§μ΄ μ λ¬λκ³ μλλ° λ§€κ°λ³μμ μλ₯Ό μ€μ΄λλ‘ λ³λμ μ½λ°± μ λ¬ κ°μ²΄λ₯Ό κ³ λ €ν΄λ³΄μλκ²λ μ’μκ² κ°μμ.
κ° μ½λ°±λ€μ΄ μ΄λ€ μ κΈ°μ μνΈκ΄κ³λ₯Ό κ°κ²λλμ§ μκ·Έλμ²λ§ 보면 μ νμ μ΄ λμ§ μμμμ
κ·Έλ¦¬κ³ Usersλ₯Ό λκΈ°κ³ λ΄λΆμμ playersλ₯Ό νν°λ§νκ²νλ€λ©΄ λ μμ νμ§ μμκΉμ?
kang-hyungu
left a comment
There was a problem hiding this comment.
μλ² λͺκ°μ§ νΌλλ°± λ¨κ²ΌμΌλ μ°Έκ³ νμΈμ
κΆκΈν μ μμΌλ©΄ μ§λ¬Έμ£ΌμΈμ~
| import java.util.List; | ||
|
|
||
|
|
||
| public class BlackjackController { |
There was a problem hiding this comment.
컨νΈλ‘€λ¬κ° λμ£ ? μ μ΄λ¦μ΄ 컨νΈλ‘€λ¬μ£ ?
|
|
||
| static final String ERROR_EMPTY_INPUT = "μ λ ₯κ°μ κ³΅λ°±μΌ μ μμ΅λλ€."; | ||
| static final String ERROR_BET_AMOUNT_NOT_INTEGER = "λ°°ν κΈμ‘μ μ«μ ννλ‘ μ λ ₯ν΄μΌ ν©λλ€ : %s"; | ||
| static final String ERROR_BET_AMOUNT_NOT_POSITIVE = "λ°°ν κΈμ‘μ 1μ μ΄μμ΄μ΄μΌ ν©λλ€ : %d"; |
There was a problem hiding this comment.
κ²μ κ·μΉμ΄ λ°κ»΄μ λ°°ν
κΈμ‘μ 1μμ΄ μλ 10μ μ΄μμΌλ‘ λ°κΏμΌνλ€λ©΄?
ν
μ€νΈλ‘λ§ μ μ§νλ©΄ μμ μ¬νμ΄ μκΈΈ λλ§λ€ λͺ¨λ λ¬Έμμ΄μ μ§μ μ°Ύμμ λ°κΏμΌκ² κ΅°μ?
| import java.util.Queue; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| public class CardProvider { |
There was a problem hiding this comment.
providerλΌκ³ μ΄λ¦ μ§μ μ΄μ κ° λκ°μ?
| public class CardProvider { | ||
|
|
||
| private static final int INIT_CARDS_START_IDX = 0; | ||
| private static final int INIT_CARDS_END_IDX = 2; |
| } | ||
| } | ||
| List<Card> cards = Arrays.stream(Rank.values()) | ||
| .flatMap(rank -> Arrays.stream(Suit.values()) |
There was a problem hiding this comment.
stream μμμ λ streamμ μ²λ¦¬νλ©΄ μ½λκ° λ³΅μ‘ν΄μ§λλ€
λ©μλλ‘ μΆμΆν΄μ μ½λ μ½κΈ° μ’κ² λ°κΏλ³΄μΈμ
|
|
||
| import blackjack.model.bet.BetAmount; | ||
|
|
||
| public enum GameResult { |
There was a problem hiding this comment.
μ μ ν ν΄λμ€λͺ
μΈκ°μ?
μ΄ ν΄λμ€κ° λ§‘μ μΌμ 무μμΈκ°μ?
| } | ||
|
|
||
| @Override | ||
| public boolean isPlayer() { |
There was a problem hiding this comment.
Userλ₯Ό μμν΄μ Player κ°μ²΄λ‘ μ μΈνλλ°, κ·Έ νμ
μ λ 체ν¬νλ λ©μλλ₯Ό λμλ€λκ² μ΄μνκ² λκ»΄μ§λ€μ
νμ
μ νμ©νκ±°λ μ€κ³λ₯Ό λ€μ κ³ λ―Όν΄λ΄μΌνμ§ μμκΉμ?
μ§κΈμ λλ¬, νλ μ΄μ΄λ§ μμ§λ§ μλ‘μ΄ κ²μ κ·μΉμ΄ μ겨μ μλ‘μ΄ userκ° μΆκ°λλ€λ©΄ κ·Έλ λ λ€λ₯Έ isXXX μ리μ¦κ° κ³μ μκΈΈ μ μκ² λ€μ
| } | ||
|
|
||
| public abstract boolean isHitAvailable(); | ||
| public GameResult judge(User user) { |
There was a problem hiding this comment.
judge λ©μλλͺ
μ μ νκ°μ?
κ²μ μ©μ΄λ‘ λ°κΏλ³΄λ©΄ μ΄λ¨κΉμ?
| @@ -11,8 +11,13 @@ public static String readPlayerName() { | |||
| return sc.nextLine(); | |||
|
|
||
| public class OutputView { | ||
|
|
||
| private static final int BLACKJACK_SCORE = 21; |
There was a problem hiding this comment.
κ²μ κ·μΉμ ν΄λΉνλ μμλ₯Ό viewμμ μ²λ¦¬νλ μ΄μ κ° μμκΉμ
μ€λ³΅ μ κ±°λ₯Ό μν΄ Finished μμ μν ν΄λμ€ μΆκ° Finished μν μΆκ°νλ©΄μ isFinished() λ©μλ μΆκ° stay() λ©μλ μΆκ°
pci2676
left a comment
There was a problem hiding this comment.
μνν¨ν΄ μ μ ν ꡬνν΄μ£Όμ ¨λ€μ
λΈλμμ μ¬κΈ°μ λ§λ¬΄λ¦¬ν΄λ μ’μκ² κ°μ΅λλ€
λ¨μ λ―Έμ λ€λ 건ν¬λ₯Ό λΉκ² μ΅λλ€.
mergeνκ² μ΅λλ€. π
| return this; | ||
| // throw new IllegalStateException("λ²μ€νΈ μνμμλ μΉ΄λλ₯Ό μΆκ°λ‘ λ°μ μ μμ΅λλ€."); |
There was a problem hiding this comment.
μ΄λ€κ² μλνμλ λ°©ν₯μΌκΉμ?
| import blackjack.model.card.Hand; | ||
| import blackjack.model.gameresult.GameResult; | ||
|
|
||
| public interface HandState { |
μ²΄ν¬ λ¦¬μ€νΈ
testλ₯Ό μ€ννμ λ, λͺ¨λ ν μ€νΈκ° μ μμ μΌλ‘ ν΅κ³Όνλμ?μ΄λ€ λΆλΆμ μ§μ€νμ¬ λ¦¬λ·°ν΄μΌ ν κΉμ?
TDD
TDDλ₯Ό μλν΄ λ³΄λ €κ³ νλ, μ²μ ν μ€νΈ νμΌμ μ΄λ¦μ μ νλ κ²λΆν° λ§νλ κ²½νμ νμ΅λλ€. TDDλ₯Ό μν΄ κ°μ₯ λ¨μν λ‘μ§μ λ¨Όμ ν μ€νΈνκΈ° μν΄μλ κ·Έ λ‘μ§μ΄ μ΄λ€ κ°μ²΄μ μ‘΄μ¬ν΄μΌ νλμ§ λ¨Όμ μ ν΄μΌ νλ 건κ°μ? λ§μ½ κ·Έλ λ€λ©΄ TDDλ‘ κ°λ°μ μμνκΈ° μ μ μ 체 μλΉμ€μ μ€κ³λ₯Ό μλ²½νκ² ν΄λμμΌ νλμ§ κΆκΈν©λλ€.
μ΄κΈ° μ€κ³
μ΄κΈ°μ μ€κ³νμ€ λ μ΄λ€ νλ¦μΌλ‘ μ΄λ€ κ°μ²΄λ€μ΄ νμν μ§ μ νμλμ§ κΆκΈν©λλ€.
리ν©ν λ§
μ΄λ²μ λ°°ν μμ΅κΈ κ³μ° κΈ°λ₯μ μΆκ°νλ κ³Όμ μμ λ§μ 리ν©ν λ§μ΄ νμνμ΅λλ€. ν λ²μ λ§μ ν΄λμ€λ€μ΄ κΌ¬μ¬μλ€ λ³΄λ μ΄λμλΆν° νμ΄λκ°μΌ ν μ§ κ°μ λͺ» μ‘μλλ°μ, μ΄λ κ² λ³΅μ‘νκ² κΌ¬μΈ μ½λλ€μ ν λλ μ΄λ€ λ°©μμΌλ‘ μ κ·Όνλ κ²μ΄ μ’μκΉμ?