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

[Step2] πŸš€ 2단계 - λΈ”λž™μž­ #656

Merged
merged 35 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e3bd640
doc: Dsl 과제 νŒ¨ν‚€μ§€ 뢄리
dlwnsgus777 Nov 17, 2023
d160388
doc: μš”κ΅¬μ‚¬ν•­ 정리
dlwnsgus777 Nov 17, 2023
8265b2e
feat: playerλŠ” 이름을 κ°€μ§ˆ 수 μžˆλ‹€.
Nov 20, 2023
aff45de
feat: cardλŠ” μˆ«μžμ™€ 무늬λ₯Ό 가진닀
Nov 20, 2023
a7a45c9
feat: card, player main package둜 이동
Nov 20, 2023
c214909
feat: King, Queen, Jackκ³Ό 같이 그림만 가지고 μžˆλŠ” μΉ΄λ“œ 클래슀 생성
Nov 20, 2023
25c40ba
feat: Ace μΉ΄λ“œ μΆ”κ°€
Nov 20, 2023
ba47608
feat: Ace μΉ΄λ“œ μΆ”κ°€
Nov 20, 2023
70cc8ab
Merge remote-tracking branch 'origin/step2' into step2
Nov 20, 2023
04e1775
feat: card pattern enum 뢄리
Nov 20, 2023
99fbfb6
doc: README update
Nov 20, 2023
29eb4b9
feat: μΉ΄λ“œ κ·Έλ¦Ό enum μΆ”κ°€ 및 μΉ΄λ“œ κ΄€λ ¨ 클래슀 νŒ¨ν‚€μ§€ 이동
Nov 21, 2023
c1868ea
feat: μΉ΄λ“œ 덱 클래슀 개발
Nov 21, 2023
3fba58d
feat: ν”Œλ ˆμ΄μ–΄λŠ” μΉ΄λ“œλ₯Ό κ°€μ§ˆ 수 μžˆλ‹€.
dlwnsgus777 Nov 21, 2023
45143ec
feat: ν”Œλ ˆμ΄μ–΄ μž…λ ₯ κΈ°λŠ₯ 개발
dlwnsgus777 Nov 21, 2023
675cb9e
feat: μΉ΄λ“œ 덱 λ“œλ‘œμš° κΈ°λŠ₯ 개발
Nov 22, 2023
4362886
feat: ν”Œλ ˆμ΄μ–΄λŠ” μΉ΄λ“œλ₯Ό 뽑을 수 μžˆλ‹€
Nov 22, 2023
8e4f0c3
feat: λΈ”λž™μž­ 첫번째 Turn κΈ°λŠ₯ 개발
Nov 23, 2023
19dc1ee
feat: μΉ΄λ“œ 좜λ ₯ κΈ°λŠ₯ 개발
Nov 23, 2023
631831f
doc: κΈ°λŠ₯ μš”κ΅¬ 사항 체크
Nov 24, 2023
ca8ad0a
doc: μΉ΄λ“œ 점수 계산 클래슀 개발
Nov 24, 2023
8d81a55
doc: READ.ME μ—…λ°μ΄νŠΈ
Nov 24, 2023
e8d5714
refactor: μ½”λ“œ λ¦¬νŒ©ν„°λ§
Nov 24, 2023
7bea84b
feat: λΈ”λž™μž­ κ²Œμž„ κΈ°λŠ₯ 개발
Nov 24, 2023
313b89a
feat: foldλ₯Ό μ‚¬μš©ν•˜λ„λ‘ λ¦¬νŒ©ν„°λ§
Nov 27, 2023
cbb058a
refactor: calcScoreλ©”μ„œλ“œ λͺ… λ³€κ²½
Nov 27, 2023
2152518
refactor: 도메인 κ°μ²΄μ—μ„œ λ·° μš”κ΅¬μ‚¬ν•­ 뢄리
Nov 27, 2023
4ac16c4
refactor: var λ³€μˆ˜λ₯Ό val λ³€μˆ˜λ‘œ λ³€κ²½
Nov 27, 2023
e32719e
refactor: λ“œλ‘œμš° κ°€λŠ₯ μ—¬λΆ€ 계산 μ±…μž„μ„ playerμ—κ²Œ μœ„μž„
Nov 27, 2023
a3316a8
test: testμ½”λ“œ μΆ”κ°€
Nov 27, 2023
72dff31
refactor: CardDeck을 object둜 λ³€κ²½
Nov 27, 2023
fec96e3
refactor: Playerκ°€ ScoreCalculatorλ₯Ό 가지고 μžˆλ„λ‘ λ³€κ²½
Nov 27, 2023
a831029
refactor: private const val λ³€μˆ˜ μΆ”κ°€
Nov 27, 2023
2b419ed
refactor: ScoreCalculator ν•¨μˆ˜ λ¦¬νŒ©ν„°λ§
Nov 27, 2023
e418997
refactor: UI 둜직 도메인 둜직과 뢄리
Nov 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
# kotlin-blackjack
# kotlin-blackjack

---

# λΈ”λž™μž­

## μš”κ΅¬ 사항 뢄석

- μž…λ ₯
- [x] κ²Œμž„μ— μ°Έμ—¬ν•  μ‚¬λžŒμ„ μž…λ ₯λ°›λŠ”λ‹€.
- [x] ν•œμž₯의 μΉ΄λ“œλ₯Ό 더 받을지 말지 μž…λ ₯λ°›λŠ”λ‹€.

- 좜λ ₯
- [x] ν”Œλ ˆμ΄μ–΄κ°€ 가지고 μžˆλŠ” μΉ΄λ“œλ₯Ό 좜λ ₯ν•œλ‹€.
- [x] κ²Œμž„μ˜ κ²°κ³Όλ₯Ό 좜λ ₯ν•œλ‹€.

- 도메인
- [x] μΉ΄λ“œκ°€ μžˆλ‹€.
- [x] μΉ΄λ“œλŠ” μˆ«μžμ™€ 무늬λ₯Ό 가진닀.
- [x] Ace, King, Queen, Jack μ΄λΌλŠ” μΉ΄λ“œλ„ μžˆλ‹€.
- [x] μΉ΄λ“œ 덱이 μžˆλ‹€.
- [x] μΉ΄λ“œ 덱은 총 51μž₯의 μΉ΄λ“œλ₯Ό 가진닀.
- [x] ν”Œλ ˆμ΄μ–΄κ°€ μžˆλ‹€.
- [x] ν”Œλ ˆμ΄μ–΄λŠ” 이름을 가진닀.
- [x] ν”Œλ ˆμ΄μ–΄λŠ” μΉ΄λ“œλ₯Ό κ°€μ§ˆ 수 μžˆλ‹€.
- [x] λΈ”λž™μž­ κ²Œμž„μ΄ μžˆλ‹€.
- [x] κ²Œμž„ μ‹œμž‘μ‹œ 두 μž₯의 μΉ΄λ“œλ₯Ό μ§€κΈ‰λ°›λŠ”λ‹€.
- [x] ν”Œλ ˆμ΄μ–΄λŠ” 가지고 μžˆλŠ” μΉ΄λ“œκ°€ 21을 λ„˜μ§€ μ•Šμ€ 경우 μΉ΄λ“œλ₯Ό 계속 뽑을 수 μžˆλ‹€.
- [x] λΈ”λž™μž­ 점수 계산기가 μžˆλ‹€.
- [x] AceλŠ” 1 λ˜λŠ” 11둜 계산할 수 μžˆλ‹€.
- [x] King, Queen, Jack λŠ” 10으둜 κ³„μ‚°ν•œλ‹€
- [x] ν”Œλ ˆμ΄μ–΄μ˜ μΉ΄λ“œλ₯Ό 점수둜 계산해 κ²°κ³Όλ₯Ό 내보낸닀

62 changes: 62 additions & 0 deletions src/main/kotlin/blackjack/GameManager.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package blackjack

import blackjack.card.CardDeck
import blackjack.ui.InputManager
import blackjack.ui.OutputManager

class GameManager(
private val inputManager: InputManager,
private val outputManager: OutputManager
) {
private val players: List<Player>

init {
players = joinPlayers()
}

fun start() {
players.forEach { it.drawCard(CardDeck.draw(FIRST_DRAW)) }

outputManager.printFirstTurn(players)
outputManager.printPlayersCards(players)

playBlackJack()

players.forEach {
outputManager.printPlayerResultGame(it)
}
}

private fun playBlackJack() {
players.forEach {
playerDraw(it)
}
}

private fun playerDraw(player: Player) {
var drawAmount = -1

while (player.shouldDraw() && drawAmount != 0) {
drawAmount = inputManager.inputShouldDrawCard(player.name)
if (playerChooseDraw(drawAmount)) {
player.drawCard(CardDeck.draw(drawAmount))
}
outputManager.printPlayerCards(player)
}
}

private fun playerChooseDraw(drawAmount: Int) = drawAmount > 0

private fun joinPlayers(): List<Player> {
val playerNames: List<String> = inputManager.inputPlayerNames()
return playerNames.map { Player(it, ScoreCalculator()) }
}

companion object {
private const val FIRST_DRAW: Int = 2
}
}

fun main() {
GameManager(InputManager(), OutputManager()).start()
}
22 changes: 22 additions & 0 deletions src/main/kotlin/blackjack/Player.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package blackjack

import blackjack.card.BlackJackCard

class Player(
val name: String,
private val scoreCalculator: ScoreCalculator
) {
val cards: MutableList<BlackJackCard> = mutableListOf()

fun drawCard(cards: List<BlackJackCard>) {
this.cards.addAll(cards)
}

fun shouldDraw(): Boolean {
return resultScore() <= 21
}

fun resultScore(): Int {
return scoreCalculator.calcScore(cards)
}
}
47 changes: 47 additions & 0 deletions src/main/kotlin/blackjack/ScoreCalculator.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package blackjack

import blackjack.card.AceCard
import blackjack.card.BlackJackCard
import blackjack.card.NormalCard
import blackjack.card.PictureCard
import kotlin.math.abs

class ScoreCalculator {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

점수λ₯Ό μš”μ²­ν•˜λŠ” 뢀뢄에 λŒ€ν•΄
μ»¨νŠΈλ‘€λŸ¬κ°€ -> ν”Œλ ˆμ΄μ–΄μ—κ²Œ μ μˆ˜κ°€ μ–Όλ§ˆμΈμ§€ μš”μ²­ -> ν”Œλ ˆμ΄μ–΄λŠ” 점수 계산 (ScoreCalculatorμ‚¬μš©)
μ΄λ ‡κ²Œ ν•΄μ„œ Playerκ°€ ScoreCalculator μ˜μ‘΄μ„±μ„ 가지도둝 ν–ˆλŠ”λ° μ΄λŸ°μ‹μ˜ 흐름이 λ¦¬λ·°μ–΄λ‹˜μ΄ 보셨을 λ•Œ μžμ—°μŠ€λŸ¬μš΄μ§€ κΆκΈˆν•©λ‹ˆλ‹€!!

μ§€κΈˆ λ‹¨κ³„μ—μ„œλŠ” 어색해보이진 μ•ŠμŠ΅λ‹ˆλ‹€! λΈ”λž™μž­ λ―Έμ…˜μ˜ 꽃은 λ°”λ‘œ λ‹€μŒ λ‹¨κ³„μ—μ„œ λ”œλŸ¬μ™€ ν”Œλ ˆμ΄μ–΄μ˜ μ±…μž„μ„ μ–΄λ–»κ²Œ λΆ„ν• ν•˜λŠ”μ§€μΈλ°μš”, λ‹€μŒ 단계 λ―Έμ…˜μ„ μ§„ν–‰ν•˜μ‹œλ©΄μ„œ μ’€ 더 κ³ λ―Όν•˜μ‹œκ²Œ λ˜κ² λ„€μš”!

fun calcScore(card: List<BlackJackCard>): Int {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ν•¨μˆ˜ 이름을 지을 λ•Œμ—λŠ” μ•½μ–΄ (calc, sub λ“±)λ₯Ό μ΅œλŒ€ν•œ ν™œμš©ν•˜μ§€ μ•ŠλŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. ν†΅μƒμ μœΌλ‘œ ν™œμš©λ˜λŠ” μ•½μ–΄(sum, println)κ°€ μ•„λ‹ˆλΌλ©΄ ν˜Όλž€μ„ 쀄 수 μžˆμ–΄μš”.

return card.filterIsInstance<AceCard>().fold(calcScoreToNormalAndPictureCard(card)) { acc, _ ->
calcAceScore(acc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fold ν™œμš© πŸ‘

}
}

private fun calcAceScore(score: Int): Int {
var totalScore = score
val plusMinAceScore = totalScore + MIN_ACE_SCORE
val plusMaxAcreScore = totalScore + MAX_ACE_SCORE

totalScore += when {
(isMinAceScoreCloser(plusMaxAcreScore, plusMinAceScore)) -> MIN_ACE_SCORE
else -> MAX_ACE_SCORE
}

return totalScore
}

private fun isMinAceScoreCloser(plusMaxAcreScore: Int, plusMinAceScore: Int): Boolean {
return abs(plusMinAceScore - BEST_SCORE) < abs(plusMaxAcreScore - BEST_SCORE)
}

private fun calcScoreToNormalAndPictureCard(card: List<BlackJackCard>) = card.sumOf {
when (it) {
is NormalCard -> it.number
is PictureCard -> PICTURE_CARD_SCORE
else -> 0
}
}

companion object {
private const val PICTURE_CARD_SCORE: Int = 10
private const val BEST_SCORE: Int = 21
private const val MIN_ACE_SCORE: Int = 1
private const val MAX_ACE_SCORE: Int = 11
}
}
3 changes: 3 additions & 0 deletions src/main/kotlin/blackjack/card/AceCard.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package blackjack.card

class AceCard(val pattern: CardPattern) : BlackJackCard
3 changes: 3 additions & 0 deletions src/main/kotlin/blackjack/card/BlackJackCard.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package blackjack.card

sealed interface BlackJackCard
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

λ”±νžˆ μ»¨λ²€μ…˜μ—μ„œ κ°•μ œν•˜μ§€λŠ” μ•Šμ§€λ§Œ 개인적으둜 sealed interface/class 등은 ν•œ νŒŒμΌμ— λͺ¨μ•„λ‘λŠ” 것이 가독성이 λ†’λ‹€κ³  μƒκ°ν•˜λŠ” νŽΈμž…λ‹ˆλ‹€! 참고만 ν•΄μ£Όμ„Έμš” γ…Žγ…Ž

sealed interface BlackJackCard {
    class AceCard(val pattern: CardPattern) : BlackJackCard
    ...
} 

45 changes: 45 additions & 0 deletions src/main/kotlin/blackjack/card/CardDeck.kt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

λ‹€μŒ λ‹¨κ³„λΆ€ν„°λŠ” λ‹€μŒ 자료λ₯Ό μ°Έκ³ ν•˜μ—¬ λΈ”λž™μž­ 도메인에 λŒ€ν•΄ 이해도λ₯Ό 높여보면 μ–΄λ–¨κΉŒμš”?

+) 특히 λ‹€μŒ λ‚΄μš©μ€ 넀이밍에 ν™œμš©ν•΄λ³΄μ…”λ„ 쒋을 것 κ°™μ•„μš”~
image

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package blackjack.card

object CardDeck {
private val deck: ArrayDeque<BlackJackCard>
private const val EMPTY_DECK_ERROR_MESSAGE: String = "μΉ΄λ“œ 덱이 λͺ¨λ‘ μ†Œμ§„λ˜μ—ˆμŠ΅λ‹ˆλ‹€."
private const val FIRST_NORMAL_CARD_NUMBER: Int = 2
private const val LAST_NORMAL_CARD_NUMBER: Int = 10

init {
val list = mutableListOf<BlackJackCard>()
initNormalCard(list)
initPictureCard(list)
initAceCard(list)

list.shuffle()
Comment on lines +10 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

κ°€λ³€ 빈 리슀트λ₯Ό λ§Œλ“€μ–΄ 이λ₯Ό 일일히 μ΄ˆκΈ°ν™”ν•˜λŠ” 절차 지ν–₯ μŠ€νƒ€μΌμ„ ν™œμš©ν•˜κΈ°λ³΄λ‹€, λΆˆλ³€ 리슀트 νƒ€μž…λ§Œ ν™œμš©ν•˜λ©΄ μ–΄λ–¨κΉŒμš”? 예λ₯Ό λ“€μ–΄ λ‹€μŒκ³Ό 같이 ν•¨μˆ˜ λ°˜ν™˜κ°’μ„ λ§Œλ“€μ–΄λ³΄λŠ”κ±°μ˜ˆμš”.

val cards: List<BlackJackCard> = normalCard() + pictureCard() + aceCard()

tip: Listμ—μ„œλŠ” shuffle()λŒ€μ‹  shuffled()λ₯Ό ν™œμš©ν•˜λ©΄ λ©λ‹ˆλ‹€.

deck = ArrayDeque(list)
}

fun getSize(): Int {
return deck.size
}

fun draw(drawNumber: Int): List<BlackJackCard> {
require(deck.size >= drawNumber) { EMPTY_DECK_ERROR_MESSAGE }
return (1..drawNumber).map { deck.removeFirst() }.toList()
}

private fun initNormalCard(list: MutableList<BlackJackCard>) {
CardPattern.values().forEach {
(FIRST_NORMAL_CARD_NUMBER..LAST_NORMAL_CARD_NUMBER).forEach { number -> list.add(NormalCard(number, it)) }
}
}

private fun initPictureCard(list: MutableList<BlackJackCard>) {
CardPattern.values().forEach {
CardPicture.values().forEach { picture -> list.add(PictureCard(picture, it)) }
}
}

private fun initAceCard(list: MutableList<BlackJackCard>) {
CardPattern.values().forEach {
list.add(AceCard(it))
}
}
}
8 changes: 8 additions & 0 deletions src/main/kotlin/blackjack/card/CardPattern.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package blackjack.card

enum class CardPattern {
DIAMOND,
CLOVER,
SPADE,
HEART;
}
7 changes: 7 additions & 0 deletions src/main/kotlin/blackjack/card/CardPicture.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package blackjack.card

enum class CardPicture {
KING,
JACK,
QUEEN;
}
3 changes: 3 additions & 0 deletions src/main/kotlin/blackjack/card/NormalCard.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package blackjack.card

class NormalCard(val number: Int, val pattern: CardPattern) : BlackJackCard
6 changes: 6 additions & 0 deletions src/main/kotlin/blackjack/card/PictureCard.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package blackjack.card

class PictureCard(
val picture: CardPicture,
val pattern: CardPattern
) : BlackJackCard
29 changes: 29 additions & 0 deletions src/main/kotlin/blackjack/ui/InputManager.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package blackjack.ui

class InputManager {
fun inputPlayerNames(): List<String> {
println(INPUT_PLAYER_NAMES_MESSAGE)
return inputUserValue().replace("\\s".toRegex(), "").split(",")
}

private fun inputUserValue(): String {
val input = readln()
require(input.isNotBlank()) { INPUT_NOT_NULL_MESSAGE }
return input.trim()
}

fun inputShouldDrawCard(name: String): Int {
println("${name}λŠ” $INPUT_SHOULD_DRAW_CARD_MESSAGE")
return when (readln()) {
"Y", "y" -> 1
"N", "n" -> 0
else -> 0
}
}

companion object {
private const val INPUT_NOT_NULL_MESSAGE = "μž…λ ₯값을 μž…λ ₯ν•΄μ£Όμ„Έμš”."
private const val INPUT_PLAYER_NAMES_MESSAGE: String = "κ²Œμž„μ— μ°Έμ—¬ν•  μ‚¬λžŒμ˜ 이름을 μž…λ ₯ν•˜μ„Έμš”.(μ‰Όν‘œ κΈ°μ€€μœΌλ‘œ 뢄리)"
private const val INPUT_SHOULD_DRAW_CARD_MESSAGE: String = "ν•œμž₯의 μΉ΄λ“œλ₯Ό 더 λ°›κ² μŠ΅λ‹ˆκΉŒ?(μ˜ˆλŠ” y, μ•„λ‹ˆμ˜€λŠ” n)"
}
}
61 changes: 61 additions & 0 deletions src/main/kotlin/blackjack/ui/OutputManager.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package blackjack.ui

import blackjack.Player
import blackjack.card.AceCard
import blackjack.card.BlackJackCard
import blackjack.card.CardPattern
import blackjack.card.CardPicture
import blackjack.card.NormalCard
import blackjack.card.PictureCard

class OutputManager {

fun printFirstTurn(players: List<Player>) {
val names: String = players.joinToString(", ") { it.name }

println("${names}μ—κ²Œ 두μž₯의 μΉ΄λ“œλ₯Ό λ‚˜λˆ„μ—ˆμŠ΅λ‹ˆλ‹€.")
}

fun printPlayersCards(players: List<Player>) {
players.forEach {
println("${it.name}: ${parsingCardsToString(it.cards)}")
}
}

fun printPlayerCards(player: Player) {
println("${player.name}: ${parsingCardsToString(player.cards)}")
}

fun printPlayerResultGame(player: Player) {
println("${player.name} μΉ΄λ“œ: ${parsingCardsToString(player.cards)} - κ²°κ³Ό: ${player.resultScore()}")
}

private fun parsingCardsToString(cards: List<BlackJackCard>): String {
return cards.joinToString(", ") { parsingCardToString(it) }
}

private fun parsingCardToString(card: BlackJackCard): String {
return when (card) {
is NormalCard -> "${card.number}${parsingCardPatternToString(card.pattern)}"
is PictureCard -> "${parsingCardPictureToString(card.picture)}${parsingCardPatternToString(card.pattern)}"
is AceCard -> "ace${parsingCardPatternToString(card.pattern)}"
}
}

private fun parsingCardPatternToString(cardPattern: CardPattern): String {
return when (cardPattern) {
CardPattern.DIAMOND -> "닀이아"
CardPattern.CLOVER -> "ν΄λ‘œλ²„"
CardPattern.SPADE -> "μŠ€νŽ˜μ΄λ“œ"
CardPattern.HEART -> "ν•˜νŠΈ"
}
}

private fun parsingCardPictureToString(cardPicture: CardPicture): String {
return when (cardPicture) {
CardPicture.KING -> "K"
CardPicture.JACK -> "J"
CardPicture.QUEEN -> "Q"
}
}
Comment on lines +45 to +60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI 둜직 뢄리 πŸ‘

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package dsl

class Languages {
private val languageMap: HashMap<String, Int> = hashMapOf()
infix fun String.level(level: Int): Unit = putLanguage(this, level)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package dsl

data class Person(
val name: String,
val company: String?,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package dsl

fun introduce(block: PersonBuilder.() -> Unit): Person {
// val personBuilder = PersonBuilder()
// personBuilder.block()
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/Skill.kt β†’ src/main/kotlin/dsl/Skill.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package dsl

class Skill {
private val hardSkills: MutableList<String> = mutableListOf()
private val softSkills: MutableList<String> = mutableListOf()
Expand Down
Loading