-
Notifications
You must be signed in to change notification settings - Fork 550
[π μ¬μ΄ν΄2 - λ―Έμ (λΈλμ λ² ν )] μλ² λ―Έμ μ μΆν©λλ€. #1102
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
Open
Chocoding1
wants to merge
82
commits into
woowacourse:chocoding1
Choose a base branch
from
Chocoding1:Chocoding1
base: chocoding1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+452
β273
Open
Changes from all commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
c15d501
docs: κΈ°λ₯ λ¬Έμ μμ±
khyej 5b1fa0f
feat: μ¬μ©μ μ΄λ¦ μ
λ ₯ κΈ°λ₯ ꡬν
khyej 6914d5e
feat: μΉ΄λ μ΅μ΄ λ°°λΆ κΈ°λ₯ ꡬν
khyej 54d9be6
feat: μ΅μ΄ μΉ΄λ νν© μΆλ ₯ κΈ°λ₯ ꡬν
khyej 219ee29
feat: μΉ΄λ μΆκ° μ§κΈ κΈ°λ₯ ꡬν
khyej 8e6ad0a
refactor: CardProvider μν λΆλ¦¬
khyej 89911aa
refactor: λ²μ€νΈ μ¬λΆ λ³μ μΆκ°
khyej 3a0577d
refactor: λ³μλͺ
μμ
khyej fd6108d
refactor: λΈλμ κΈ°λ‘ λ° μ‘°ν λ©μλ μΆκ°
khyej 7dd3ffe
test: BlackjackController λ¨μ ν
μ€νΈ μμ±
khyej 0ce22d2
docs: κΈ°λ₯ λͺ©λ‘ μμ
khyej ccc2f7d
feat: μ¬μ©μλ³ μΉ΄λ νν© λ° ν©κ³ μΆλ ₯
khyej 9e9bff0
feat: μ΅μ’
μΉν¨ κ³μ° λ° μΆλ ₯ κΈ°λ₯ ꡬν
khyej 414c5b3
feat: κ²μ μΉν¨ κ³μ° λ‘μ§ μΆκ°
khyej 18f2d9c
refactor: μΆλ ₯λ¬Έ νμ μμ
khyej f58565d
feat: μμΈ μ²λ¦¬ μΆκ°
khyej a2b6b06
refactor: getter μ κ±°
khyej d855fc4
refactor: λ§€μ§λ³μ μμν
khyej 46807d6
docs: ꡬν κΈ°λ₯ λͺ©λ‘ μμ
Chocoding1 e97ce9b
test: DisplayName μμ
Chocoding1 00f55da
refactor: Card κ°μ²΄ μ€κ³ μμ
Chocoding1 0075c48
refactor: μ΄λ¦ κ°κ°μ²΄ μμ±
Chocoding1 0fa789c
refactor: name κ°κ°μ²΄ μμ±μ λ°λ₯Έ μμ
Chocoding1 05dc9f3
refactor: μΉ΄λ μΆκ° μ¬λΆ μ
λ ₯κ° κ°μ²΄ μμ±
Chocoding1 7abdbed
refactor: User μΆμ ν΄λμ€λ‘ λ³κ²½ & μΆμ λ©μλ μΆκ°
Chocoding1 b9ac11c
refactor: Users κ°μ²΄ μμ±
Chocoding1 64a8d08
refactor: ν΄λμ€λͺ
λ³κ²½ & CardCalculator μ±
μ μμ
Chocoding1 9719248
chore: μμλͺ
μμ
Chocoding1 417f72f
refactor: ν΄λμ€λͺ
μμ & λ©μλ μΆκ°
Chocoding1 19a74ec
chore: getter μΆκ°
Chocoding1 a4cdc0e
chore: getter μΆκ°
Chocoding1 32383b4
refactor: λ± μ΄κΈ°ν λ‘μ§ μμ
Chocoding1 b0622b2
refactor: CardCalculator μ κ±° -> Handλ‘ μν μμ
Chocoding1 ded3f8b
refactor: λ±μ΄ μμ§λ κ²½μ° λ± μ¬μμ± λ‘μ§ μΆκ°
Chocoding1 b85d895
refactor: GameResultCalculator ν΄λμ€ μμΈ & Users ν΄λμ€λ‘ μν μμ
Chocoding1 fcba505
refactor: μΆλ ₯ λ‘μ§ μμ
Chocoding1 556d1de
refactor: μ½λ 컨벀μ
μ μ©
Chocoding1 da880c7
chore: λ―Έμ¬μ© λΌμ΄λΈλ¬λ¦¬ import μ κ±°
Chocoding1 6ba5301
refactor: PlayersGameResult κ°μ²΄ μμ±
Chocoding1 08ce109
refactor: GameResult νλ μ κ±°
Chocoding1 efdaba9
refactor: addAceScore() μ κ·Ό μ μ΄μ privateμΌλ‘ λ³κ²½
Chocoding1 c375bae
refactor: Controller μ±
μ λΆλ¦¬
Chocoding1 991503c
refactor: Map λΌμ΄λΈλ¬λ¦¬ λ©μλ κ΅μ²΄
Chocoding1 d0398d1
refactor: ν΄λ ꡬ쑰 λ³κ²½
Chocoding1 ef6e0d2
refactor: 곡백 κ²μ¦ λ©μλ μμ
Chocoding1 a63f529
refactor: λ―Έμ¬μ© λ©μλ μμ
Chocoding1 df9803a
refactor: 곡백 κ²μ¦ λ©μλ μμ
Chocoding1 b2d2d36
refactor: UserName -> Username ν΄λμ€λͺ
μμ
Chocoding1 9ec41b6
test: λ¨μ ν
μ€νΈ μμ λ° μΆκ°
Chocoding1 e9ee2f0
refactor: ν΄λ ꡬ쑰 λ³κ²½
Chocoding1 05a9504
refactor: κ²μ¦ λ©μλ μ κ·Ό μ μ΄μ μμ
Chocoding1 f397b1c
refactor: λ©μλ λΆλ¦¬
Chocoding1 4b56ae8
refactor: ErrorMessage ν΄λμ€ μ κ±°
Chocoding1 0e7417d
test: ν΄λ ꡬ쑰 μμ
Chocoding1 9c6c404
refactor: ErrorMessage ν΄λμ€ μ κ±°
Chocoding1 ebf96c6
refactor: μμ ν΄λμ€ μ κ±°
Chocoding1 9c2cab0
docs: λ°°ν
κΈ°λ₯ μΆκ°
Chocoding1 7a3a4cd
docs: κΈ°λ₯ μμ "
Chocoding1 f712193
refactor: Users νλ List<User>λ‘ μμ
Chocoding1 5f0d2e3
refactor: BlackjackGame κ°μ²΄ μμ± & Controller μ±
μ λΆλ¦¬
Chocoding1 d550531
feat: λ°°ν
κΈμ‘ μ
λ ₯ κΈ°λ₯ ꡬν
Chocoding1 9047d7a
chore: λ―Έμ¬μ© λΌμ΄λΈλ¬λ¦¬ μ κ±°
Chocoding1 1dffd25
refactor: Controller μ±
μ λΆλ¦¬
Chocoding1 a2712e2
refactor: Controller μ±
μ λΆλ¦¬
Chocoding1 ffa2e70
refactor: BetAmounts νλ μλ£κ΅¬μ‘° μμ
Chocoding1 4b142e6
feat: μμ΅ κ³μ° λ° μΆλ ₯ κΈ°λ₯ ꡬν
Chocoding1 ba922a4
refactor: ν΄λ ꡬ쑰 λ³κ²½
Chocoding1 ff2a3a1
refactor: μ΅μ’
μμ΅ λ‘μ§ μ±
μ λΆλ¦¬
Chocoding1 7174a93
refactor: κ²μ μ’
λ£ λ©μλ BlackjackGameμΌλ‘ μμ
Chocoding1 104aea2
test: λ¨μ ν
μ€νΈ μμ±
Chocoding1 338152f
refactor: νλΌλ―Έν° κ°μλ₯Ό μ€μ΄κΈ° μν΄ λ©μλ λΆλ¦¬
Chocoding1 c783fbb
chore: λ©μλ μμ μμ
Chocoding1 5e46963
refactor: indent 2 -> indent 1λ‘ μμ
Chocoding1 da1e88f
fix: λΈλμΉ μΆ©λ ν΄κ²°
Chocoding1 58be5be
refactor: null λ°ννμ§ μλλ‘ λ©μλ ꡬ쑰 μμ
Chocoding1 bb11f00
refactor: μλ¬ λ©μμ§ λ΄μ© μμ
Chocoding1 ee03f6c
refactor: λ°©μ΄μ λ³΅μ¬ μ μ©
Chocoding1 26b13e7
refactor: λ―Έμ¬μ© νλ, λ©μλ μ κ±°
Chocoding1 ad9f3b4
refactor: BlackjackGameμμ View μ°Έμ‘° μ κ±°
Chocoding1 fdf622c
test: λ―Έμ¬μ© λ³μ λ° μ€λ³΅ ν
μ€νΈ ν΄λμ€ μ κ±°
Chocoding1 6fe7b0b
refactor: λ―Έμ¬μ© νλΌλ―Έν° μ κ±°
Chocoding1 e36f7b4
refactor: μΉν¨ νμ λ‘μ§ Playerλ‘ μ΄λ
Chocoding1 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 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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| package blackjack; | ||
|
|
||
| import static blackjack.util.ExceptionHandler.retryUntilSuccess; | ||
|
|
||
| import blackjack.model.bet.BetAmount; | ||
| import blackjack.model.bet.BetAmounts; | ||
| import blackjack.model.card.CardProvider; | ||
| import blackjack.model.card.HitCommand; | ||
| import blackjack.model.gameresult.ProfitResult; | ||
| import blackjack.model.user.Dealer; | ||
| import blackjack.model.user.Player; | ||
| import blackjack.model.user.Users; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.function.Consumer; | ||
| import java.util.function.Function; | ||
| import java.util.function.Supplier; | ||
|
|
||
| public class BlackjackGame { | ||
|
|
||
| private final CardProvider cardProvider; | ||
|
|
||
| public BlackjackGame(CardProvider cardProvider) { | ||
| this.cardProvider = cardProvider; | ||
| } | ||
|
|
||
| public Users createUsers(Supplier<String> readUsername) { | ||
| String input = readUsername.get(); | ||
| return new Users(input); | ||
| } | ||
|
|
||
| public BetAmounts createBetAmount(Function<Player, String> readBetAmount, Users users) { | ||
| List<Player> players = users.getPlayers(); | ||
| Map<Player, BetAmount> betAmounts = new HashMap<>(); | ||
| for (Player player : players) { | ||
| String input = readBetAmount.apply(player); | ||
| BetAmount betAmount = new BetAmount(input); | ||
| betAmounts.put(player, betAmount); | ||
| } | ||
| return new BetAmounts(betAmounts); | ||
| } | ||
|
|
||
| public void provideInitCards(Users users) { | ||
| cardProvider.provideInitCards(users); | ||
| } | ||
|
|
||
| public void hitPlayers(List<Player> players, Function<Player, String> readHitCommand, | ||
| Consumer<Player> printPlayerCards, Runnable printCantHit) { | ||
| for (Player player : players) { | ||
| hitPlayer(player, readHitCommand, printPlayerCards, printCantHit); | ||
| } | ||
| } | ||
|
|
||
| public void hitDealer(Dealer dealer, Runnable printDealerHit) { | ||
| while (dealer.isHitAvailable()) { | ||
| cardProvider.provideOneCard(dealer); | ||
| printDealerHit.run(); | ||
| } | ||
| } | ||
|
|
||
| public ProfitResult determineWinner(Users users, BetAmounts betAmounts) { | ||
| return users.determineWinner(betAmounts); | ||
| } | ||
|
|
||
| public void end(Runnable closeScanner) { | ||
| closeScanner.run(); | ||
| } | ||
|
|
||
| private void hitPlayer(Player player, Function<Player, String> readHitCommand, Consumer<Player> printPlayerCards, | ||
| Runnable printCantHit) { | ||
| if (!isHitAvailable(player, printCantHit)) { | ||
| return; | ||
| } | ||
|
|
||
| while (retryUntilSuccess(() -> checkY(player, readHitCommand))) { | ||
| cardProvider.provideOneCard(player); | ||
| printPlayerCards.accept(player); | ||
| } | ||
| } | ||
|
|
||
| private boolean checkY(Player player, Function<Player, String> readHitCommand) { | ||
| String input = readHitCommand.apply(player); | ||
| HitCommand hitCommand = new HitCommand(input); | ||
| return hitCommand.isY(); | ||
| } | ||
|
|
||
| private boolean isHitAvailable(Player player, Runnable printCantHit) { | ||
| if (player.isHitAvailable()) { | ||
| return true; | ||
| } | ||
Chocoding1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| printCantHit.run(); | ||
| return false; | ||
| } | ||
| } | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package blackjack.model.bet; | ||
|
|
||
| public class BetAmount { | ||
|
|
||
| private static final String ERROR_EMPTY_INPUT = "μ λ ₯κ°μ κ³΅λ°±μΌ μ μμ΅λλ€."; | ||
| private static final String ERROR_BET_AMOUNT_NOT_INTEGER = "λ°°ν κΈμ‘μ μ«μ ννλ‘ μ λ ₯ν΄μΌ ν©λλ€."; | ||
| private static final String ERROR_BET_AMOUNT_NOT_POSITIVE = "λ°°ν κΈμ‘μ 1μ μ΄μμ΄μ΄μΌ ν©λλ€."; | ||
|
|
||
| private final int amount; | ||
|
|
||
| public BetAmount(String input) { | ||
| validateEmpty(input); | ||
| int amount = convertToInt(input); | ||
| validatePositive(amount); | ||
| this.amount = amount; | ||
| } | ||
|
|
||
| public int getAmount() { | ||
| return amount; | ||
| } | ||
|
|
||
| private void validateEmpty(String input) { | ||
| if (input.isBlank()) { | ||
| throw new IllegalArgumentException(ERROR_EMPTY_INPUT); | ||
| } | ||
| } | ||
|
|
||
| private void validatePositive(int amount) { | ||
| if (amount <= 0) { | ||
| throw new IllegalArgumentException(ERROR_BET_AMOUNT_NOT_POSITIVE); | ||
| } | ||
| } | ||
|
|
||
| private int convertToInt(String input) { | ||
| try { | ||
| return Integer.parseInt(input); | ||
| } catch (NumberFormatException e) { | ||
| throw new IllegalArgumentException(ERROR_BET_AMOUNT_NOT_INTEGER); | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package blackjack.model.bet; | ||
|
|
||
| import blackjack.model.user.Player; | ||
| import java.util.Map; | ||
|
|
||
| public class BetAmounts { | ||
|
|
||
| private final Map<Player, BetAmount> betAmounts; | ||
|
|
||
| public BetAmounts(Map<Player, BetAmount> betAmounts) { | ||
Chocoding1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| this.betAmounts = Map.copyOf(betAmounts); | ||
| } | ||
|
|
||
| public BetAmount findByPlayer(Player player) { | ||
| return betAmounts.get(player); | ||
| } | ||
| } | ||
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
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.
λ΅λ³μ μ΄λμ λ¨κΈΈκΉ νλ€κ° readme μμ±νμ κ³³μ΄ μ μ ν κ² κ°μμ λ΅λ³λλ €μ~
TDDλ₯Ό μμνκΈ°μ μμ μꡬμ¬νμ λ¨Όμ μ 리νλκ² κ°μ΅λλ€.
μꡬμ¬νμ μ 리ν λ νμν κΈ°λ₯λ€μ΄ 무μμ΄ μλμ§ λμ΄ν΄λ³΄κ³ μ±κ²©μ΄ λΉμ·ν κ² λΌλ¦¬ λ¬Άμ΄λ΄ λλ€.
κ·Έλ¦¬κ³ μꡬμ¬νμ ν΄κ²°νκΈ° μν κ°μ²΄λ€μ΄ μ΄λ€κ²λ€μ΄ νμν μ§ μ΄λ€ κ°μ²΄λΌλ¦¬ μνΈμμ©μν μ§ κ·Έλ €λ³΄λκ² κ°λ€μ. μ΄λ μ±κ²©μ΄ λΉμ·ν κ²λΌλ¦¬ λ¬Άμ νλμ μ§ν©μ΄ νλμ κ°μ²΄κ° λκ±°λ μ¬λ¬κ°μ κ°μ²΄λ‘ ν λΉλλκ² κ°λ€μ.
μλμ κ°μ μμλ₯Ό 보μ¬λ릴μ μμκ² κ°λ€μ
μ μμλ μ λ§ κ°λ¨νκ² μμ±ν κ² μ΄κ³ μ§κΈ μ νν μμ±νλΌκ³ νλ€λ©΄ λ μΈμΈνκ² μμ±ν κ² κ°κΈ΄νλ€μ
λ°©λ²μ΄μΌ μ¬λ¬κ°μ§κ² μ§λ§ μ΄λ¬ν κ³Όμ μ μ€λ¬΄λ₯Ό νλ©΄μλ μμλ¨κ³μ ν΄λΉνλ κ΅μ₯ν μ€μν μμ μ΄λ μ°μ΅ν΄λ³΄μλ©΄ μ’μκ² κ°μ΅λλ€ :)
μΆκ°λ‘ κΆκΈν μ μ΄ μλ€λ©΄ νΈνκ² μ§λ¬Έμ£ΌμΈμ