-
Notifications
You must be signed in to change notification settings - Fork 313
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
๐ 4๋จ๊ณ - ๋ธ๋์ญ(๋ฒ ํ ) #827
base: sjjeong
Are you sure you want to change the base?
Conversation
๊ธฐ์กด์ ์นํจ๊ฐ ๋์์ง๋ง ์ด์ ๋ ์ต์ข ์์ต์ด ๋์ค๋๋ก ํจ
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.
์์ค๋ ์ต๊ทผ์ ์ด์ฌ ์ค๋น๋ก ์ ์ ์ด ์์ด์ ๋ฆฌ๋ทฐ๊ฐ ๋ฆ์์ต๋๋ค. ๐ฅฒ
4๋จ๊ณ๋ ๊ตฌํ ์ ํด์ฃผ์
จ๋ค์. ๐
๋ช๋ช ์ฝ๋ฉํธ ๋จ๊ฒจ๋์์ผ๋ ํ์ธ ๋ถํ๋๋ฆด๊ฒ์. ๐
participants.forEach { participant -> | ||
println("${participant.name}์ ๋ฐฐํ ๊ธ์ก์?") | ||
val bettingMoney = readlnOrNull()?.toIntOrNull() ?: error("๋ฐฐํ ์ ") | ||
participant.bettingMoney = bettingMoney |
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.
Participant๊ฐ View์์ ๋ฒ ํ
์ ํ๊ณ ์๊ตฐ์? ๐ค
์ด ๊ธฐ๋ฅ์ ๋๋ฉ์ธ ๋ก์ง์ผ๋ก ๋ณผ ์ ์์ง ์์๊น์? ๐
participants.forEach { participant -> | ||
println("${participant.name}์ ๋ฐฐํ ๊ธ์ก์?") | ||
val bettingMoney = readlnOrNull()?.toIntOrNull() ?: error("๋ฐฐํ ์ ") | ||
participant.bettingMoney = bettingMoney |
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.
Participant ๊ฐ์ฒด์๊ฒ ๋ฒ ํ ์ํ๋ผ๊ณ ๋ฉ์์ง๋ฅผ ๋ณด๋ด๋ณด๋ฉด ์ด๋จ๊น์? ๐
|
||
constructor(vararg participantNames: String): this(participantNames.map { name -> Participant(name.trim()) }) | ||
|
||
fun setupCard(blackjackShoe: BlackjackShoe) { |
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.
setupCard
๋ผ๋ ํํ๋ณด๋ค๋ ์กฐ๊ธ ๋ (๋ฅ๋์ ์ธ) ๊ฐ์ฒด์ ์
์ฅ์์ ํ์๋ฅผ ํ๋ ๊ฒ ๊ฐ์(?) ๋ค์ด๋ฐ์ ๊ณ ๋ คํด๋ณด๋ฉด ์ด๋จ๊น ์ถ์ด์.
์ฐธ๊ฐ์์ ์
์ฅ์์ ์ด๊ธฐ ํจ๋ฅผ ๋ฝ๋๋ค
์ ๊ฐ์ ํ์์ ๊ด์ ์ผ๋ก ํํํ๋ฉด
์ฐธ๊ฐ์.์ด๊ธฐ ํจ๋ฅผ ๋ฝ๋๋ค
์ ๊ฐ์ด ํํํ๋ฉด ์ง๊ด์ ์ผ๋ก ์ดํดํ๊ธฐ๊ฐ ์กฐ๊ธ ๋ ์ฝ์ง ์์๊น์? ๐
@@ -0,0 +1,10 @@ | |||
package blackjack.domain | |||
|
|||
class Participants(private val participants: List<Participant>): List<Participant> by participants { |
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.
by
ํค์๋ ํ์ฉ ๐๐ฏ
ํ์ฌ Participants
์ผ๊ธ์ปฌ๋ ์
์ by
ํค์๋๋ฅผ ํ์ฉํด์ ๊ตฌํํด์ฃผ์
จ๋ค์.
by ํค์๋๋ฅผ ์ฌ์ฉํ์ ๋์ ์ฅ์ ๊ณผ ๋จ์ ์ ์๊ณ ๊ณ์ ์ง ๊ถ๊ธํฉ๋๋ค. :)
๊ฐ๋ณ๊ฒ ์ฝ๋ฉํธ๋ก ๋จ๊ฒจ์ฃผ์๋ฉด ์ข์ ๊ฒ ๊ฐ์์. ๐
@@ -19,6 +19,10 @@ abstract class Player( | |||
return score | |||
} | |||
|
|||
var money: Int = 0 |
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.
๊ผญ ์์๊ฐ ์ ํด์ ธ์๋ ๊ฒ์ ์๋์ง๋ง, ๊ฐ์ธ์ ์ธ ์๊ฐ์ผ๋ก๋ ์ฝ๊ธฐ์ ์ฉ ํ๋กํผํฐ๋ณด๋ค๋ ์ค์ Palyer
์ ์ํ๊ฐ์ธ money๊ฐ ๋ ์์์ ์์ด์ผํ์ง ์์๊น ์ถ์ด์. ๐ค
@@ -3,12 +3,21 @@ package blackjack.domain | |||
data class Participant( | |||
override val name: String |
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.
name
ํ๋กํผํฐ๋ ์ค๋ฒ๋ผ์ด๋ ํ ํ์ ์์ด, ๋จ์ํ Player์ ์์ฑ์ ํ๋ผ๋ฏธํฐ๋ก ์ ๋ฌ๋งํด์ฃผ๋ฉด ๋ ๊ฒ ๊ฐ์๋ฐ์.
์ค๋ฒ๋ผ์ด๋ํ์ ์ด์ ๊ฐ ์์ผ์ค๊น์? ๐
|
||
outputView.showReady(dealer = dealer, participants = participants) | ||
return dealer to participants | ||
} | ||
|
||
private fun play(dealer: Dealer, participantList: List<Participant>, blackjackShoe: BlackjackShoe) { | ||
participantList.forEach { participant -> | ||
private fun play(dealer: Dealer, participants: Participants, blackjackShoe: BlackjackShoe) { |
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.
ready()
๋ play()
์ ๊ฒฝ์ฐ dealer๏ฟฝ, participants๋ฅผ ํ๋กํผํฐ๋ก ๊ฐ์ง BlackjackGame
๊ฐ์ฒด์๊ฒ ์ญํ ์ ์์ํด๋ณผ ์๋ ์์ ๊ฒ ๊ฐ์์. ๐
๋ฌผ๋ก ์ค๊ฐ์ ์
๋ ฅ๋ฐ๋ ๋ถ๋ถ๋ค์ด ์์ด์, ์กฐ๊ธ ์ด๋ ต๊ฒ ๋๊ปด์ง์ค ์๋ ์์ ๊ฒ ๊ฐ๋ค์.
์ด ๋ฐฉํฅ์ผ๋ก ํ๋ฒ ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์!
๋ง์ง๋ง ๊ณผ์ ์์ ๋ฐฐํ ๊ธ์ก๊ณผ ์์ต์ ์ด๋ป๊ฒ ์ฒ๋ฆฌํด์ผํ ์ง ๊ณ ๋ฏผ์ด ์์์ต๋๋ค.
๋ง์ง๋ง๊น์ง ๋ฆฌ๋ทฐ ํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค ๐