Last active
August 29, 2015 14:09
-
-
Save siosio/89030f100e42d9c8e7c7 to your computer and use it in GitHub Desktop.
( ・ㅂ・)و ̑̑ グッ
This file contains 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
import java.util.Random | |
private val INPUT = arrayListOf("ジョ", "ン", "ボ", "ヴィ") | |
private val RANDOM = Random() | |
fun main(args: Array<String>) { | |
var count = 0 | |
val generator: () -> String = { | |
count++ | |
stream {() -> RANDOM.nextInt(INPUT.size) } | |
.take(2) | |
.map { i -> INPUT.get(i) } | |
.toList() | |
.join("") | |
} | |
val result = stream(generator(), {it + "・" + generator() }) | |
.first{it.endsWith("ジョン・ボン・ジョヴィ")} | |
println(""" | |
${result} | |
${count} Bon Jovis | |
_人人人人人人人人人人人人人人_ | |
> You Give Love a Bad Name < | |
 ̄Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y ̄ | |
""") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment