Skip to content
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

Open
wants to merge 4 commits into
base: sjjeong
Choose a base branch
from

Conversation

sjjeong
Copy link

@sjjeong sjjeong commented Jan 7, 2025

๋งˆ์ง€๋ง‰ ๊ณผ์ œ์—์„œ ๋ฐฐํŒ… ๊ธˆ์•ก๊ณผ ์ˆ˜์ต์„ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•ด์•ผํ• ์ง€ ๊ณ ๋ฏผ์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
๋งˆ์ง€๋ง‰๊นŒ์ง€ ๋ฆฌ๋ทฐ ํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ๐Ÿ™

image

Copy link

@Rok93 Rok93 left a 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
Copy link

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
Copy link

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) {
Copy link

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 {
Copy link

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
Copy link

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
Copy link

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) {
Copy link

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 ๊ฐ์ฒด์—๊ฒŒ ์—ญํ• ์„ ์œ„์ž„ํ•ด๋ณผ ์ˆ˜๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”. ๐Ÿ˜ƒ
๋ฌผ๋ก  ์ค‘๊ฐ„์— ์ž…๋ ฅ๋ฐ›๋Š” ๋ถ€๋ถ„๋“ค์ด ์žˆ์–ด์„œ, ์กฐ๊ธˆ ์–ด๋ ต๊ฒŒ ๋Š๊ปด์ง€์‹ค ์ˆ˜๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™๋„ค์š”.

์ด ๋ฐฉํ–ฅ์œผ๋กœ ํ•œ๋ฒˆ ๊ณ ๋ฏผํ•ด๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants