-
Notifications
You must be signed in to change notification settings - Fork 320
π 3λ¨κ³ - λΈλμ(λλ¬) #653
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
moto6
wants to merge
81
commits into
next-step:moto6
Choose a base branch
from
moto6:step3
base: moto6
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.
Open
Changes from 59 commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
4530961
refactor : μΈλΆμμ λΈλμ μΉ΄λλ₯Ό λ½λ μ λ΅μ μ£Όμ
λ°λλ‘ λ¦¬ν©ν λ§
kep-dong-22 768e5e8
learn : λ―Έμμ± νμ΅μ½λλ₯Ό μμ±μν΄ : λ°©μ΄μ λ³΅μ¬ κ΄λ ¨ μμ μ½λ
kep-dong-22 f595abb
learn : λ―Έμμ± νμ΅μ½λλ₯Ό μμ±μν΄ : λ°©μ΄μ λ³΅μ¬ κ΄λ ¨ μμ μ½λ μμ±
kep-dong-22 2c3439f
learn : λ―Έμμ± νμ΅μ½λλ₯Ό μμ±μν΄ : λ°©μ΄μ λ³΅μ¬ κ΄λ ¨ μμ μ½λ μμ±
kep-dong-22 ec334d4
refactor : Pair<> μλ£κ΅¬μ‘°λ₯Ό νλμ ν΄λμ€λ‘ λ¬Άμ
kep-dong-22 2196d5b
refactor : κ³Όλνκ² κΈΈκ³ λ€μ λΆμ‘±ν ννμ λ³μλͺ
μ μ μ νκ² μμ
kep-dong-22 193b74b
docs : μꡬμ¬ν λΆμ
kep-dong-22 2e6ed51
test : λλ¬ ν΄λμ€λ₯Ό μΆκ°νκ³ , λλ¬ν΄λμ€μμ μ±
μμ μΌν μν μ λν΄ ν
μ€νΈμ½λ μμ±
kep-dong-22 dc3c6f6
feat : μ°Έκ°μ λͺ
λ¨μ λλ¬ μΆκ°
kep-dong-22 01dd4ca
refactor : νλ μ΄μ΄λ‘ λ³μλͺ
μμ
kep-dong-22 c294555
refactor : λλ¬ ν΄λμ€ μΆκ°
kep-dong-22 2f9e2f2
refactor : λλ¬μ μν μ λν ν
μ€νΈμ½λ μμ±
kep-dong-22 cf0f5f2
refactor : λλ¬μ μν μ λν ν
μ€νΈμ½λ μμ±
kep-dong-22 c651d71
feat : λλ¬ ν΄λμ€μ κΈ°λ₯ ꡬν
kep-dong-22 1f8d48f
feat : λλ¬ κΈ°λ₯ ꡬνμ μν ν΄λμ€ μμ±
kep-dong-22 2008753
feat : λλ¬ κΈ°λ₯ ꡬν
kep-dong-22 0cf2ee0
feat : λλ¬ κΈ°λ₯ ꡬν
kep-dong-22 d5d036d
test : ν΄λμ€ μ΄μ μΌλ‘ μΈν μ±
μμμ¬ λ³κ²½μΌλ‘ ν
μ€νΈλ₯Ό μ΄λμν¨λ€
kep-dong-22 e1a92a3
feat : λλ¬ μΆλ ₯ κΈ°λ₯ ꡬν
kep-dong-22 fd08d2e
feat : λλ¬ μΆλ ₯ κΈ°λ₯ ꡬν
kep-dong-22 72c2a9f
feat : λλ¬μ νλ μ΄μ΄κ° κ³΅ν΅ λμμ μΈν°νμ΄μ€λ‘ λ¬Άμ
kep-dong-22 405c44e
feat : λλ¬μ νλ μ΄μ΄κ° κ³΅ν΅ λμμ μΈν°νμ΄μ€λ‘ λ¬Άμ
kep-dong-22 3fc2d98
feat : λλ¬μ νλ μ΄μ΄κ° κ³΅ν΅ λμμΈ κ²μ νλ μ΄λ₯Ό μΈν
νμ΄μ€λ‘ μΆμνν¨
kep-dong-22 118b83b
feat : λλ¬μ νλ μ΄μ΄μ λΈλμ νλμ΄μ μ λ΅μ μΈν°νμ΄μ€ν νλ€
kep-dong-22 bc99f47
feat : κΉ¨μ§ ν
μ€νΈμ½λ μ κ±°
kep-dong-22 0e3a932
refactor : ν¨ν€μ§ ꡬ쑰ν
kep-dong-22 73c8890
refactor : λΆνμν μ£Όμ μ κ±°
kep-dong-22 cea03de
refactor : ν¨ν€μ§ μ΄λ
kep-dong-22 030b03f
refactor : μμΉ λ³κ²½
kep-dong-22 f3ce24d
refactor : ν½μ€μ³λ₯Όμ΄μ©ν΄μ λ°λ³΅λλ λ°μ΄ν° μμ± μ€λ³΅ μ½λλ₯Ό μ κ±°
kep-dong-22 b90b454
refactor : κ²μ¦ λ¨μΈλ¬Έμ μΆκ°ν¨
kep-dong-22 8426423
refactor : λΈλμ κ²μμΌλ‘ ν΄λμ€λ₯Ό λΆλ¦¬ν¨
kep-dong-22 a83a725
refactor : λ©μλλͺ
μμ
kep-dong-22 a33565d
refactor : λλ¬μ κ²°κ³Όμ 보λ₯Ό λ§λ€κΈ° μν΄μ μ¬νμ΄ μ νλκ²μ΄ μλ, λλ¬ κ°μ²΄ λ΄λΆμμ λλ¬μ κ²°κ³Όλ₯Ό λ§λ€λλ‘ μμ
kep-dong-22 5267bff
refactor : κ²°κ³Όμ 보λ₯Ό μΆλ ₯νκΈ° μν΄ λ€λ₯Έ νλ μ΄μ΄λΈμ μ
λ ₯λ°λλ‘ μμ
kep-dong-22 fb97643
refactor : κ³Όλνκ² λ³΅μ‘ν result κ°μ²΄λ€μ μ κ±°νλ€
kep-dong-22 7abf5ad
refactor : λΈλμμ μ μλ₯Ό λνλ΄λ λλ§€μΈ ν¬μ₯ν΄λμ€λ₯Ό μΆκ°νλ€
kep-dong-22 3ee585d
refactor : BlackJack() λλ§€μΈ ν¬μ₯ν΄λμ€λ₯Ό μ μ©νλ€
kep-dong-22 7c15dae
refactor : BlackJack() λλ§€μΈ ν¬μ₯ν΄λμ€λ₯Ό μ μ©ν΄μ νλ μ΄μ΄λΈ μΈν°νμ΄μ€μμ λ©μμ§λ‘ μ¬μ©νκ² μμ νμμ΅λλ€
kep-dong-22 73e3a94
refactor : λΈλμμ κ²°κ³Όλ₯Ό λνλ΄λ λ°©λ²μ κ°μ ν΄μ μ
λ ₯ arg λ‘ λ°λ ν΄λμ€λ₯Ό λ³κ²½νμμ΅λλ€
kep-dong-22 0f0ea7d
refactor : burst μ¬λΆλ₯Ό μΈλΆμ κ°μ²΄(Referee) κ° κ°μ κΊΌλ΄μ νλ¨ν΄μ£Όλ κΈ°μ‘΄ λ°©μμ μμ νμμ΅λλ€.
kep-dong-22 8481f0e
refactor : 리ν©ν λ§μ νλ€ λ³΄λ μ¬ν μν μ νλ Referee λ₯Ό μ κ±°ν μ μκ² λμμ΅λλ€
kep-dong-22 9df4b97
refactor : λμ΄λ player, Dealer ν΄λμ€μ μ±
μκ³Ό μν μ κ²μ¦νκΈ° μν΄ λ¨μν
μ€νΈλ μΆκ°λμμ΅λλ€
kep-dong-22 bc61788
refactor : λλ¬μ κ²°κ³Όλ₯Ό λλ¬ ν΄λμ€ λ΄λΆμμ κ²°μ νλλ‘ μμ
kep-dong-22 a0f1238
refactor : λͺ¨λ νλ μ΄μ΄λ νλ½ν λκΉμ§ μΉ΄λλ₯Ό λ°μ μ μλ€ κΈ°λ₯μ ꡬν
kep-dong-22 57bc00c
refactor : μΈν
리μ μ΄ μλμ΄ λ¨μ§μλλ‘ κ²½κ³ λ₯Ό μμ
kep-dong-22 f96536d
refactor : λΈλμ κ²μμ λ£°μΈ, νλ μ΄μ΄μ€ μ΅νν¬ νλͺ
μ΄ λ¨μλκΉμ§ μΉ΄λλ₯Ό λ°μ μ μλ€
kep-dong-22 caf5ab4
refactor : λΈλμ κ²μμμ μΉ΄λλ₯Όλ½λ μ μ±
μ μΈλΆμμ μ£Όμ
λ°λλ‘ μμ
kep-dong-22 d15d30e
refactor : λΆνμν λ©μλ μ κ±°
kep-dong-22 149d549
refactor : λΈλμμ μνλ₯Ό λνλ΄λ λ³μ μΆκ°
kep-dong-22 fd79141
refactor : λΈλμ κ²μμμ νλ μ΄μ΄μ μνλ₯Ό νμΈν μ μλ λ³μ μΆκ°
kep-dong-22 92ec4b5
refactor : λλ¬μ νλ μ΄μ΄κ° μμ‘΄μ¬λΆμ λν΄μ μνλ₯Ό μ μ₯νμ§ μκ³ λ§€λ² κ³μ°νλλ‘ μμ
kep-dong-22 0bde0c3
style : style formatting
kep-dong-22 b58ab33
test : λ³νλ μ±
μκ³Ό μν μ λ°λΌ ν
μ€νΈμ½λ μ΄λ λ° μΆκ°
kep-dong-22 57d5ed8
test : νλ μ΄μ΄κ° μ΄κΈ°λ κ²½μ°μ λν ν
μ€νΈμ½λ μΆκ°
kep-dong-22 ec56d38
test : λλ¬ ν΄λμ€μ λν ν
μ€νΈ μ½λ μΆκ°
kep-dong-22 de4eb89
style : μ€νμΌ ν¬λ©ν
kep-dong-22 f7d07c5
refactor : μ μ±
μμ μ
λ ₯μ λ°λλ‘ μμ
kep-dong-22 a2a5e6e
refactor : ν¨ν€μ§ μ΄λ
kep-dong-22 1292c65
refactor : νλ μ΄μ΄ μ΄λ¦μ μΆλ ₯νλλ‘ μμ
kep-dong-22 3e17672
refactor : μΆλ ₯ λ‘μ§ μ κ²
kep-dong-22 9a47953
refactor : μΆλ ₯ λ‘μ§ μ κ²
kep-dong-22 515e2a9
refactor : λΆνμν μ½λ μ κ±°
kep-dong-22 cbf46fc
feat : κ²μ¦μ© νμ€, λλ²κΉ
ν¬μΈνΈ
kep-dong-22 953086a
refactor : ν¨ν€μ§ μ΄λ
kep-dong-22 9bd27f7
refactor : ν¨ν€μ§ μ΄λ
kep-dong-22 f3773b7
test : μλ¬κ° λλ λΆλΆμ ν
μ€νΈμ½λ μΆκ°
kep-dong-22 a81cff6
refactor : κ°λ
μ±μ λ리기 μν΄ νλ¦¬λ―Έν° λ€μ΄λ°
kep-dong-22 f0a699c
refactor : ν¨ν€μ§ ꡬ쑰 μ 리
kep-dong-22 d7d3af1
refactor : ν¨ν€μ§ ꡬ쑰 μ 리
kep-dong-22 1d1e228
refactor : λΈλμμ κ²½κΈ° κ²°κ³Όλ₯Ό μ ν΄μ£Όλ ν΄λμ€ λΆλ¦¬
kep-dong-22 043ffcc
test : λΈλμμ λ£°μ λͺ°λΌ μμμ μΌλ‘ μ νλ ν
μ€νΈμ½λλ€μ μμ
kep-dong-22 930745b
test : λΈλμμ κ²½κΈ° κ²°κ³Όλ₯Ό κ²°μ νλ ν
μ€νΈμ½λλ₯Ό μμ±νλ€
kep-dong-22 366b2b2
test : stand λ₯Ό μΈμΉλ©΄ μλμΌλ‘ λμ΄μ μΉ΄λλ₯Ό λ°μ μ μλ μνκ° λμ΄μΌνλ€
kep-dong-22 be3bc4d
bugfix : λ²κ·Έκ° λλ λΆλΆμ μμ
kep-dong-22 b20b5c5
refactor : μλͺ» μμ±λ ν
μ€νΈμ½λ μμ
kep-dong-22 4f07cb3
refactor : μΆλ ₯νμ μμ
kep-dong-22 e4a59a0
bugfix : λλ¬μ μΉν¨ μΆλ ₯ λ²κ·Έλ₯Ό μμ
kep-dong-22 9632f36
test : ν
μ€νΈμ½λ μΆκ°
kep-dong-22 53faf16
refactor : μμ±μ νλΌλ―Έν° μΆκ°
kep-dong-22 4769e26
bugfix: λ²κ·Έμμ
kep-dong-22 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,16 @@ | ||
| package blackjack | ||
|
|
||
| import blackjack.model.Participants | ||
| import blackjack.model.Player | ||
| import blackjack.model.BlackJackGame | ||
| import blackjack.model.pack.impl.ShuffledPack | ||
| import blackjack.view.InputView | ||
| import blackjack.view.OutputView | ||
|
|
||
| fun main() { | ||
| val participants = InputView.join() | ||
| participants.dealing() | ||
| participants.dealing(ShuffledPack) | ||
| OutputView.dealing(participants) | ||
| OutputView.presentCards(participants) | ||
| while (participants.isContinue()) { | ||
| playingBlackJack(participants) | ||
| } | ||
| OutputView.result(participants) | ||
| } | ||
|
|
||
| fun playingBlackJack(participants: Participants) { | ||
| participants.participants.forEach { | ||
| it.hitOrStand() | ||
| } | ||
| } | ||
|
|
||
| private fun Player.hitOrStand() { | ||
| if (InputView.askHit(this)) { | ||
| this.hit() | ||
| } | ||
| OutputView.playerCardPresent(this) | ||
| BlackJackGame(participants, ShuffledPack).start() | ||
| OutputView.presentScores(participants) | ||
| OutputView.presentResult(participants) | ||
| } |
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,32 @@ | ||
| package blackjack.model | ||
|
|
||
| import blackjack.model.pack.Pack | ||
| import blackjack.model.playblestrategy.PlayingStrategy | ||
| import blackjack.model.playblestrategy.impl.DealerStrategy | ||
| import blackjack.view.OutputView | ||
|
|
||
| class BlackJackGame( | ||
| private val participants: Participants, | ||
| private val pack: Pack, | ||
| ) { | ||
| fun start() { | ||
| while (participants.isContinue()) { | ||
| playingBlackJackTurn(pack) | ||
| } | ||
| } | ||
|
|
||
| private fun playingBlackJackTurn(pack: Pack) { | ||
| playersTurn(pack) | ||
| val dealerScore = participants.dealer.score() | ||
| dealerTurn(DealerStrategy(dealerScore), pack) | ||
| } | ||
|
|
||
| private fun dealerTurn(playingStrategy: PlayingStrategy, pack: Pack) { | ||
| val playing = participants.dealer.playing(playingStrategy, pack) | ||
| OutputView.presentDealerAction(playing) | ||
| } | ||
|
|
||
| private fun playersTurn(pack: Pack) { | ||
| participants.players.playingTurn(pack) | ||
| } | ||
| } |
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,6 @@ | ||
| package blackjack.model | ||
|
|
||
| enum class BlackJackStatus { | ||
| ALIVE, | ||
| DIE, | ||
| } |
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 |
|---|---|---|
| @@ -1,21 +1,23 @@ | ||
| package blackjack.model | ||
|
|
||
| import blackjack.model.pack.Pack | ||
| import blackjack.model.playable.impl.Dealer | ||
|
|
||
| class Participants( | ||
| val participants: Set<Player>, | ||
| val players: Players, | ||
| val dealer: Dealer, | ||
| ) { | ||
| fun count(): Int { | ||
| return participants.size | ||
| } | ||
|
|
||
| fun dealing() { | ||
| participants.forEach { it.deal() } | ||
| fun dealing(pack: Pack) { | ||
| players.dealing(pack) | ||
| dealer.dealing(pack) | ||
| } | ||
|
|
||
| private fun isGameOver(): Boolean { | ||
| return participants.none { Referee.isBlackJack(it) } | ||
| fun isContinue(): Boolean { | ||
| return players.hasAnyAlivePlayer() && dealer.isNotBurst() | ||
| } | ||
|
|
||
| fun isContinue(): Boolean { | ||
| return !isGameOver() | ||
| fun count(): Int { | ||
| return players.count() + 1 | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
| package blackjack.model | ||
|
|
||
| import blackjack.model.pack.Pack | ||
| import blackjack.model.playblestrategy.impl.ConsoleInputStrategy | ||
| import blackjack.model.playable.impl.Player | ||
|
|
||
| class Players( | ||
| val values: Set<Player>, | ||
| ) { | ||
| init { | ||
| require(values.map { it.name }.distinct().size == values.size) { "Player λ€μ μ΄λ¦μ μ€λ³΅μ΄ νμ©λμ§ μμ΅λλ€" } | ||
| } | ||
|
|
||
| constructor(vararg players: Player) : this(players.toSet()) | ||
|
|
||
| fun dealing(pack: Pack) { | ||
| values.forEach { it.dealing(pack) } | ||
| } | ||
|
|
||
| fun hasAnyAlivePlayer(): Boolean { | ||
| val burstPlayers: List<Boolean> = values.map { it.status() == BlackJackStatus.ALIVE }.toList() | ||
| return burstPlayers.contains(true) | ||
| } | ||
|
|
||
| fun count(): Int { | ||
| return values.size | ||
| } | ||
|
|
||
| fun playingTurn(pack: Pack) { | ||
| values.forEach { | ||
| if (it.status() == BlackJackStatus.ALIVE) { | ||
| it.playing(ConsoleInputStrategy(), pack) | ||
| } | ||
| } | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
src/main/kotlin/blackjack/model/Card.kt β src/main/kotlin/blackjack/model/card/Card.kt
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 |
|---|---|---|
| @@ -1,20 +1,20 @@ | ||
| package blackjack.model | ||
| package blackjack.model.card | ||
|
|
||
| class Card private constructor( | ||
| val suit: Suit, | ||
| val cardRank: CardRank, | ||
| ) { | ||
| companion object { | ||
| private val CARDS: Map<Pair< Suit, CardRank>, Card> by lazy { | ||
| private val CARDS: Map<Trump, Card> by lazy { | ||
| Suit.values().flatMap { suit -> | ||
| CardRank.values().map { rank -> | ||
| (suit to rank) to Card(suit, rank) | ||
| Trump(suit to rank) to Card(suit, rank) | ||
| } | ||
| }.toMap() | ||
| } | ||
|
|
||
| fun of(suit: Suit, cardRank: CardRank): Card { | ||
| return requireNotNull(this.CARDS[suit to cardRank]) { "μ λ ₯λ suit=[$suit] , cardRank=[$cardRank] λ μ°Ύμμ μμ΅λλ€" } | ||
| return requireNotNull(CARDS[Trump(suit to cardRank)]) { "μ λ ₯λ suit=[$suit] , cardRank=[$cardRank] λ μ°Ύμμ μμ΅λλ€" } | ||
| } | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
src/main/kotlin/blackjack/model/CardRank.kt β ...n/kotlin/blackjack/model/card/CardRank.kt
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package blackjack.model | ||
| package blackjack.model.card | ||
|
|
||
| enum class CardRank( | ||
| val score: Int, | ||
|
|
||
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,11 @@ | ||
| package blackjack.model.card | ||
|
|
||
| enum class Suit( | ||
| val alias: String, | ||
| ) { | ||
| SPADE("μ€νμ΄λ"), | ||
| HEART("ννΈ"), | ||
| DIAMOND("λ€μ΄μ"), | ||
| CLOVER("ν΄λ‘λ²"), | ||
| ; | ||
| } |
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,6 @@ | ||
| package blackjack.model.card | ||
|
|
||
| @JvmInline | ||
| value class Trump( | ||
| val trump: Pair<Suit, CardRank>, | ||
| ) |
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
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/blackjack/model/playable/BlackjackScore.kt
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,28 @@ | ||
| package blackjack.model.playable | ||
|
|
||
| @JvmInline | ||
| value class BlackjackScore( | ||
| val value: Int | ||
| ) { | ||
| infix fun vs(other: BlackjackScore): PlayableResult { | ||
| if (this.value == other.value) { | ||
| return PlayableResult.DRAW | ||
| } | ||
| if (this.value > other.value) { | ||
| return PlayableResult.WIN | ||
| } | ||
| return PlayableResult.LOSE | ||
| } | ||
|
|
||
| fun isBurst(): Boolean { | ||
| return this.value > BLACK_JACK_SCORE | ||
| } | ||
|
|
||
| operator fun compareTo(other: BlackjackScore): Int { | ||
| return this.value.compareTo(other.value) | ||
| } | ||
|
|
||
| companion object { | ||
| private const val BLACK_JACK_SCORE: Int = 21 | ||
| } | ||
| } |
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,14 @@ | ||
| package blackjack.model.playable | ||
|
|
||
| import blackjack.model.BlackJackStatus | ||
| import blackjack.model.pack.Pack | ||
| import blackjack.model.playblestrategy.PlayingStrategy | ||
|
|
||
| interface Playable { | ||
| fun score(): BlackjackScore | ||
| fun dealing(pack: Pack) | ||
| fun playing(playingStrategy: PlayingStrategy, pack: Pack): PlayableReaction | ||
| fun result(playable: Playable): PlayableResult | ||
| fun isBurst(): Boolean | ||
| fun status(): BlackJackStatus | ||
| } |
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,6 @@ | ||
| package blackjack.model.playable | ||
|
|
||
| enum class PlayableReaction { | ||
| HIT, | ||
| STAND | ||
| } |
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,7 @@ | ||
| package blackjack.model.playable | ||
|
|
||
| enum class PlayableResult { | ||
| WIN, | ||
| LOSE, | ||
| DRAW, | ||
| } |
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.
Cards κ°μ²΄λ₯Ό λΆλ³ κ°μ²΄λ‘ λ§λ€μ΄λ³΄λ μλλ₯Ό ν΄λ³΄μ λ μ’κ² λ€μ π