Created
April 12, 2016 07:47
-
-
Save masahitojp/ba086840c3544c76bcbbcc71fdfecdac 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 scala.annotation.tailrec | |
| import scala.util.Random | |
| object ZDK { | |
| val Z = "Z" | |
| val D = "D" | |
| val K = "K" | |
| @tailrec | |
| def zundoko(zd: List[String] = Nil): List[String] = zd match { | |
| case D :: Z :: Z :: Z :: Z :: _ => zd.reverse | |
| case _ => zundoko((if(Random.nextBoolean) Z else D) :: zd) | |
| } | |
| println(zundoko().mkString("") +K) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment