Last active
November 23, 2019 13:30
-
-
Save kmdsbng/075d5fd9c8f5c61c6c18fae00368cc5c to your computer and use it in GitHub Desktop.
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
interface BooBoo { | |
fun sayBoo(): String | |
} | |
data class Tanon(val char: String) : BooBoo { | |
override fun sayBoo(): String = char | |
} | |
data class Choon(val char: String) : BooBoo { | |
override fun sayBoo(): String = char + "ー" | |
} | |
fun main() { | |
val chars = listOf("ボ", "ジョ", "レ", "ヌ", "ボ") | |
val shuffled = chars.shuffled() | |
val tanons = shuffled.take(2).map {Tanon(it)} | |
val choons = shuffled.drop(2).map {Choon(it)} | |
val booBoos = tanons + choons | |
println(booBoos.map {it.sayBoo()}.joinToString("")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment