[π μ¬μ΄ν΄2 - λ―Έμ (λΈλμ κ²μ μ€ν)] μλ΄ λ―Έμ μ μΆν©λλ€.#1111
[π μ¬μ΄ν΄2 - λ―Έμ
(λΈλμ κ²μ μ€ν)] μλ΄ λ―Έμ
μ μΆν©λλ€.#1111RealTake wants to merge 51 commits intowoowacourse:realtakefrom
Conversation
- Deck.cardsνλλ₯Ό SetμΌλ‘ μ νν΄μ μ€λ³΅μ λν λ¬Έμ λ°©μ§ - Deck.draw() μμ finally λ¬Έμ μ¬μ©νλ λμ μ½λ νλ¦μΌλ‘ κ°μ
fix: hit&Stand λ‘μ§ μ€λ₯ μμ
- DefaultBlackjackRule: judgeλ₯Ό Participant κΈ°λ°μΌλ‘ λ³κ²½, BLACKJACK κ²°κ³Ό μΆκ° - κ° νλ μ΄μ΄ λ³ λ°°ν κΈμ‘ μ λ ₯ λ°μ
Gyuchool
left a comment
There was a problem hiding this comment.
μλ
νμΈμ μλ΄
μ¬μ΄ν΄2 λ―Έμ
μ§ννμλλΌ κ³ μνμ
¨μ΅λλ€!! μ ꡬνν΄μ£Όμ
¨λ€μπ
λͺ κ°μ§ μ½λ©νΈλ₯Ό λ¨κ²¨λμμΌλ λ°μ λ° μ견 μ£Όμλ©΄ μ’μ κ² κ°μ΅λλ€.π
κΆκΈν μ μ DMμ΄λ PR 컀λ©νΈλ‘ μΈμ λ μ§ μ¬μ€λ΄μ£ΌμΈμ!
- BlackjackGameμ΄ Players.getPlayerList()λ‘ μ»¬λ μ μ κ°μ Έμ μννλ©΄μ μμ΅μ κ³μ°νλ λ°©μ
- Players λ΄λΆμ μμ΅ κ³μ° λ©μλλ₯Ό λκ³ BlackjackGameμμλ ν΄λΉ λ©μλλ₯Ό νΈμΆλ§ νλ λ°©μ
λ κ°μ§ ꡬ쑰 μ€ μΌκΈ 컬λ μ μ μλμ λλ©μΈ μ± μ λΆλ¦¬ μΈ‘λ©΄μμ μ΄λ€ κ΅¬μ‘°κ° λ μ μ ν μ§ κΈ°λ‘ μ μ견μ λ£κ³ μΆμ΅λλ€!
blackJackGameμ μΉ΄λ κ²μ μ§νμ λ€λ£¨κ³ μκΈ°μ μμ΅ κ³μ°μ λν μ± μμ λ€λ₯Έ κ°μ²΄μ 맑겨보λ건 μ΄λ¨κΉμ? 리뷰 λ°μνλ©΄μ μ΄λ€ κ°μ²΄κ° λ€λ€μΌν μ§ ν¨κ» κ°μ ν΄κ°λ³΄μμ£ ..!
Serviceμ μν μ΄ DTO λ³νκ³Ό blackjackGame.xxx() ν λ²λ§ νΈμΆνλ λ¨μ μμμ΄λΌ, μ²μλΆν° μλΉμ€ λ μ΄μ΄λ₯Ό λμ§ λ§μμ΄μΌ νλ μΆμ΅λλ€.
- μ§κΈ ꡬ쑰λ₯Ό μ μ§ν μ± βService = μ§μ μ + DTOβ μν λ§ λͺ μν μ§
- Service λ μ΄μ΄λ₯Ό μ κ±°νκ³ Controllerκ° Gameμ μ§μ μΈμ§
리뷰μλ λ¨κ²Όλλ° μ λ λͺ¨νΈνλ€κ³ λλΌκ³ μμ΄μπ μλ΄μ μ²μ μ€κ³ν λ service blackjackGameμ κ°κ° μ΄λ€ μν λ‘ νμ©νλ €κ³ serviceλ₯Ό μΆκ°νμμκΉμ?
| } | ||
|
|
||
| private boolean hasDuplicatedName(List<String> playerNames) { | ||
| return playerNames.size() != playerNames.stream().distinct().count(); |
There was a problem hiding this comment.
μ€λ³΅ νμΈμ μν΄ μλ£κ΅¬μ‘°λ₯Ό νμ©ν΄λ³΄λ©΄ μ΄λ¨κΉμ?
| final List<Player> players = playerNames.stream() | ||
| .map(Player::new) | ||
| .toList(); |
There was a problem hiding this comment.
playerκ°μ²΄ μμ± μ± μμ BlackjacServiceλ³΄λ€ Playersμκ² λκΈ°λ건 μ΄λ μ€κΉμ?
There was a problem hiding this comment.
λλ¬λ λ§μ°¬κ°μ§λ‘ μ μ ν κ³³μμ κ°μ²΄ μμ±νλ©΄ μ’μ κ² κ°λ€μ:)
| private int readPlayerBattingMoneyRetry(String playerName) { | ||
| int battingMoney = -1; | ||
|
|
||
| while (battingMoney <= 0) { | ||
| battingMoney = readPlayerBattingMoney(playerName); | ||
| } | ||
| return battingMoney; | ||
| } |
There was a problem hiding this comment.
do-whileλ¬Έμ νμ©νλ©΄ μ΄λ¨κΉμ? μ§κΈμ -1μ μλ―Έλ₯Ό ν΄μνκΈ° μ΄λ ΅λ€μ..!
| import team.blackjack.view.OutputView; | ||
|
|
||
| public class BlackJackController { | ||
| private final BlackJackService blackJackService; |
There was a problem hiding this comment.
μλ΄μ΄ μκ°νμκΈ°μ blackJackControllerμ blackJackServiceμ κ°κ° μν μ΄ λ¬΄μμΌκΉμ?
νμ¬λ λ‘μ§μ΄ Controllerμ λ λ§μ κ² κ°μλ° μ΄λ»κ² μκ°νμ€κΉμ?
| OutputView.printAskDrawCard(playerName); | ||
| String hitYn = InputView.readHitDecision(); | ||
|
|
||
| while (!"y".equalsIgnoreCase(hitYn) && !"n".equalsIgnoreCase(hitYn)) { |
There was a problem hiding this comment.
"y","n"μ΄ λ°λ³΅λλ μμλ‘ κ΄λ¦¬νλ건 μ΄λ μ€κΉμ?
| public void drawInitialCards() { | ||
| this.players.initPlayerHands(deck); | ||
|
|
||
| this.dealer.hit(dealer.draw(deck)); |
There was a problem hiding this comment.
| this.dealer.hit(dealer.draw(deck)); | |
| this.dealer.hit(deck.draw()); |
μ΄λ κ²λ ꡬνν μ μμ κ² κ°μλ° dealer.draw()λ©μλλ₯Ό λ§λ μ΄μ κ° μμκΉμ?
| private double calculateMoney(Player player) { | ||
| final Result result = judge(player); | ||
| return result.getOdds() * player.getBatMoney(); | ||
| } | ||
|
|
||
| private Result judge(Player player) { | ||
| if (player.isBust()) { |
There was a problem hiding this comment.
μ μ κ³μ° λ° νλ¨νλ λ‘μ§μ μ€μν λ‘μ§μΈλ°μ. ν μ€νΈκ° κ°λ₯ν κ΅¬μ‘°κ° μλκ² κ°λ€μ..! μ μ ν κ°μ²΄μκ² μ± μμ λ겨보λ건 μ΄λ¨κΉμ?
|
|
||
| public List<Integer> getScore() { | ||
| return this.number.score; | ||
| public Set<Integer> getScore() { |
| public Dealer dealer; | ||
| public Player pobi; | ||
| public Player jason; | ||
| public Players players; | ||
| public BlackjackGame game; |
| public class Player extends Participant { | ||
| private final String name; | ||
| private final List<Hand> hands; | ||
| private double batMoney; |
There was a problem hiding this comment.
κ·μΉ 3: λͺ¨λ μμκ°κ³Ό λ¬Έμμ΄μ ν¬μ₯νλ€.
λ°°ν
κΈμ‘μ΄ μμκ° μλλλ‘ viewμμ μ λ§μΌμ
¨μ΄μ..!π
λ€λ§, λ°°ν
κΈμ‘μ΄ μμκ° μλλ건 λλ©μΈ κ·μΉμ ν΄λΉλλ€κ³ μκ°νλλ° λλ©μΈμμλ κ²μ¦νλ건 μ΄λ μ€κΉμ?
μλ νμΈμ, κΈ°λ‘ !
μ£Όμ νΌλλ°±μ μ¬λ¬ λ² κ³±μΉμ΄ 보면μ λ€μν λ°©μλ μλν΄ λ³΄λλΌ PRκ³Ό λ΅μ₯μ λ¦κ² μ¬λ¦¬κ² λμ΄ μ£μ‘ν©λλ€γ γ
νΌλλ°±μ λ°νμΌλ‘ λ€λ₯Έ ν¬λ£¨λΆλ€κ³Όλ μ견μ λλκ³ , μ¬λ¬ ν¬λ£¨λ€μ μ½λλ₯Ό μ΄ν΄λ³΄λ©΄μ μ κ° λ―Έμ² μκ°νμ§ λͺ»νλ λ°©μμ΄λ ν€μλλ€μ λ§μ΄ μκ² λμμ΅λλ€. λλΆμ λ§μ κ²μ λ°°μ°λ μκ°μ΄ λμκ³ , κ·Έλ¬λ€ 보λ μΌμ£ΌμΌμ΄ μ λ§ λΉ λ₯΄κ² μ§λκ° κ² κ°μ΅λλ€.
νΉν μ€λκΈ°κ° κ°λ°μ ν΄μ€λ©΄μ μ£Όμ λν κ΄λ¦¬μ λμμ΄ λ μ μλ€λ μ μ μκ°νμ§ λͺ»νλ λΆλΆμ΄λΌ μμ§λ λ΅..ν©λλ€..!
PRμ μμ λ€μ μ’μ νΌλλ°± μ£Όμ μ λ€μ ν λ² κ°μ¬λ립λλ€..!
μ²΄ν¬ λ¦¬μ€νΈ
testλ₯Ό μ€ννμ λ, λͺ¨λ ν μ€νΈκ° μ μμ μΌλ‘ ν΅κ³Όνλμ?μ΄λ€ λΆλΆμ μ§μ€νμ¬ λ¦¬λ·°ν΄μΌ ν κΉμ?
μν©
μ¬μ΄ν΄ 2μμ λ°°ν κΈ°λ₯μ΄ μΆκ°λλ©΄μ κ° μ°Έκ°μμ μμ΅μ κ³μ°ν΄μΌ νλ μꡬμ¬νμ΄ μκ²Όμ΅λλ€.
νμ¬λ BlackjackGameμ calculateAllPlayerRevenue() λ©μλμμ μ 체 νλ μ΄μ΄μ μμ΅μ κ³μ°νκ³ μμ΅λλ€.
μ΄ κ³Όμ μμ Players λ΄λΆμ νλ μ΄μ΄λ€μ μνν΄μΌ νκΈ° λλ¬Έμ Players.getPlayerList() λ©μλλ₯Ό λ§λ€κ² λμμ΅λλ€.
κ³ λ―Ό
getPlayerList()λ λ΄λΆ 컬λ μ μ μΈλΆλ‘ λ ΈμΆνκ² λλ―λ‘ μΌκΈ 컬λ μ μ μ·¨μ§μ λ€μ μ΄κΈλλ κ²μ΄ μλμ§ κ³ λ―Όμ΄ λμμ΅λλ€.
κ·Έλμ calculateAllPlayerRevenue() λ©μλλ₯Ό Players λ΄λΆλ‘ μ΄λμν€λ κ²λ νλμ λ°©λ²μ΄λΌκ³ μκ°νμ΅λλ€.
λ§μΉ¨ Playerκ° betMoney νλλ₯Ό κ°μ§κ³ μκΈ° λλ¬Έμ Playersκ° κ° Playerλ₯Ό μννλ©° μμ΅μ κ³μ°νλ ꡬ쑰λ κ°λ₯ν΄ λ³΄μ λλ€.
λ€λ§ μμ΅ κ³μ°μ΄λΌλ νμκ° Playerλ Players보λ€λ κ²μμ κ·μΉκ³Ό νλ¦μ λ΄λΉνλ BlackjackGameμμ μ²λ¦¬νλ κ²μ΄ λ μμ°μ€λ¬μ΄ κ²μ μλμ§ κ³ λ―Όμ΄ λ©λλ€.
리뷰 μμ²
1. BlackjackGameμ΄ Players.getPlayerList()λ‘ μ»¬λ μ μ κ°μ Έμ μννλ©΄μ μμ΅μ κ³μ°νλ λ°©μ
2. Players λ΄λΆμ μμ΅ κ³μ° λ©μλλ₯Ό λκ³ BlackjackGameμμλ ν΄λΉ λ©μλλ₯Ό νΈμΆλ§ νλ λ°©μ
λ κ°μ§ ꡬ쑰 μ€ μΌκΈ 컬λ μ μ μλμ λλ©μΈ μ± μ λΆλ¦¬ μΈ‘λ©΄μμ μ΄λ€ κ΅¬μ‘°κ° λ μ μ ν μ§ κΈ°λ‘ μ μ견μ λ£κ³ μΆμ΅λλ€!
2. Serviceμ Gameμ μν κ²½κ³
μν©
-> getterλ₯Ό μ κ±°νλ λμ μλΉμ€κ° μ κ²ν°λ₯Ό μ¬μ©ν΄μ μ°κ² λλμ§λ₯Ό λ³΄κ³ , κ·Έ μ΄μ λ₯Ό λ€μ gameμμ νλλ‘ νλ€λ³΄λ, λλΆλΆμ μλΉμ€ λ‘μ§λ€μ΄ GameμΌλ‘ μ΄λνκ² λμμ΅λλ€. μ§κΈμ Gameμ΄ κ²μ μ§ν λ‘μ§βμ, Serviceκ° βGame μμ± + Game μμ + DTO λ³νβμ λ§‘κ³ μμ΅λλ€.
νμ¬ μλΉμ€ ν΄λμ€μ μν μ λλ©μΈμ μ§μ 컨νΈλ‘€λ¬μ λ°ν νκΈ° λ³΄λ¨ DTOλ₯Ό λ³νν΄μ μ£Όλλ° μλ―Έλ₯Ό λκ³ μμ΅λλ€.
κ³ λ―Ό
Serviceμ μν μ΄ DTO λ³νκ³Ό blackjackGame.xxx() ν λ²λ§ νΈμΆνλ λ¨μ μμμ΄λΌ, μ²μλΆν° μλΉμ€ λ μ΄μ΄λ₯Ό λμ§ λ§μμ΄μΌ νλ μΆμ΅λλ€.
리뷰 μμ²
κΈ°λ‘ μ μ견μ λ£κ³ μΆμ΅λλ€.!
μκ° λ΄μ΄ λ¦¬λ·°ν΄ μ£Όμ μ λ€μ ν λ² κ°μ¬λ립λλ€..!