Created
December 2, 2016 09:58
-
-
Save hmhmsh/cdea0cf70c22184f7de12a8bca89cd06 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
import java.util.* | |
val ppap = listOf("I have a βοΈ", "I have a π", "I have an π", "I have a βοΈ") | |
fun getPPAP(count : Int) : String { | |
println(ppap[count]) | |
return ppap[count] | |
} | |
fun compile() { | |
var list = mutableListOf("") | |
while(true) { | |
list.add(getPPAP(Math.abs(Random().nextInt() % 3))) | |
if( list.takeLast(4).equals(ppap) ) { | |
println("PEN_PINEAPPLEβοΈπ , APPLE_PENβοΈπ") | |
break | |
} | |
} | |
} | |
compile() |
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
import java.util.* | |
Random().let { | |
val ppap = listOf("βοΈ", "π", "π", "βοΈ") | |
generateSequence { ppap[Math.abs(it.nextInt() % 3)] } | |
.fold(mutableListOf(""), { a, b -> | |
println("I have " + (if (b.equals("π")) "an " else "a ") + b) | |
a.add(b) | |
if (a.takeLast(4).equals(ppap)) { | |
println(ppap.reduce { a, b -> a + b }) | |
return@let | |
} | |
a | |
}) | |
} |
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
I have a π | |
I have a π | |
I have a π | |
I have a π | |
I have a βοΈ | |
I have an π | |
I have an π | |
I have a βοΈ | |
I have a π | |
I have a π | |
I have a π | |
I have a π | |
I have a π | |
I have a βοΈ | |
I have an π | |
I have a π | |
I have an π | |
I have a π | |
I have an π | |
I have a π | |
I have an π | |
I have a βοΈ | |
I have an π | |
I have a βοΈ | |
I have a π | |
I have an π | |
I have a βοΈ | |
βοΈππβοΈ | |
[Finished in 3.1s] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment