-
Notifications
You must be signed in to change notification settings - Fork 466
[2단계 - 블랙잭 베팅] 리비(이근희) 미션 제출합니다. #709
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
Changes from 40 commits
dc1784a
00925f7
aa40342
0fee0a8
a4ac7f3
29e2ed4
89a3f97
816ac37
40032f9
c897464
db48a37
dca030e
1f9bf86
1c8c377
a76e3db
dd7530f
5cbd135
72e2d5c
16eb547
f9ee5d3
700e657
a3b7922
8cf986d
eb34b94
830e832
a13b60e
fd7732d
6d4f7a1
195e7d8
2a5b203
3fbb924
930b671
45ad9d9
9aa8485
ac045c6
c07d431
758dff6
fe10aa3
5cb4331
8456dd7
638e4eb
89212ef
ae37ad2
17149f1
acc80aa
78f92db
2108b79
be5d84d
31a49df
bf40b62
d48fe97
8a035a5
ba81574
ac68319
c09639f
0a8cfbc
cc9f461
d322e72
99325f5
13f58d2
79a851b
a1ac0da
eaa7fe4
15a5788
0d896e5
a51e5b6
c71f92e
96e6f7d
d59d083
8a0c604
4dc1507
9f01f90
b0e72b8
da40b6e
ebe1b7c
b1e9891
f68fde2
195c0fa
bd391fd
e85556d
9760406
274a281
a5cf7a0
4288420
44b2c55
d6b7005
996c313
15aa17c
04f05f8
7473ac1
70424a9
2080860
589afe7
587af88
a5806ae
eda8a6e
445ef7c
97578a5
79f85ff
3c9b32a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||
| package blackjack.domain.bet; | ||||||
|
|
||||||
| public class BetAmout { | ||||||
|
||||||
| public class BetAmout { | |
| public class BetAmount { |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||
| package blackjack.domain.bet; | ||||||
|
|
||||||
| import blackjack.domain.player.Dealer; | ||||||
| import blackjack.domain.player.Player; | ||||||
| import blackjack.domain.result.GameResult; | ||||||
| import blackjack.domain.result.PlayerProfits; | ||||||
| import java.util.Map; | ||||||
| import java.util.stream.Collectors; | ||||||
|
|
||||||
| public class PlayerBets { | ||||||
|
|
||||||
| private final Map<Player, BetAmout> playerBets; | ||||||
|
|
||||||
| public PlayerBets(Map<Player, BetAmout> playerBets) { | ||||||
| this.playerBets = playerBets; | ||||||
| } | ||||||
|
|
||||||
| public PlayerProfits calculateProfitResult(Dealer dealer) { | ||||||
| return new PlayerProfits(playerBets.keySet().stream() | ||||||
| .collect(Collectors.toMap( | ||||||
| player -> player, | ||||||
| player -> (calculatePlayerProfit(player, dealer))))); | ||||||
|
||||||
| player -> (calculatePlayerProfit(player, dealer))))); | |
| player -> calculatePlayerProfit(player, dealer)))); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package blackjack.domain.bet; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| public class Profit { | ||
|
|
||
| private final int value; | ||
|
|
||
| public Profit(int value) { | ||
| this.value = value; | ||
| } | ||
|
|
||
| public Profit add(Profit other) { | ||
| return new Profit(this.value + other.value); | ||
| } | ||
|
|
||
| public Profit inverse() { | ||
| return new Profit(-1 * value); | ||
| } | ||
|
|
||
| public int getValue() { | ||
| return value; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
| Profit profit = (Profit) o; | ||
| return value == profit.value; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(value); | ||
| } | ||
| } |
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를 사용하고 있네요 👀
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.
실습의 의미로 자료구조 변경해보겠습니다 💪🏻
제가 만든 클래스가 특정 자료형에 종속적인지도 확인해 볼 수 있을 것 같아요 👍