Last active
December 22, 2017 12:35
-
-
Save benetis/c428b14a9b54e6782b16058d67801358 to your computer and use it in GitHub Desktop.
Christmas golf
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
val b = """ [___] | |
/:' \ | |
|:: | | |
\::. / | |
\::./ | |
'=' """ | |
val r = ".--._" | |
val s = " " ++ r ++ "\n _(_" | |
val f = r.reverse ++ "\n _)_" | |
val m = r ++ r.reverse ++ "\n _Y_" | |
def light(n: Int, c: Int): Seq[Seq[String]] = { | |
def r(u: String): Seq[String] = u.split("\n") ++ b.split("\n") | |
c match { | |
case c if c == n => Seq(r(s)) ++ light(n, c-1) | |
case c if c == 0 => Seq(r(f)) | |
case _ => Seq(r(m)) ++ light(n, c-1) | |
} | |
} | |
val n = 4 | |
val res = light(n, n) | |
res.foreach(println) | |
for(i <- 0 to 7) { | |
for(k <- 0 to n) { | |
print(res(k)(i)) | |
} | |
print("\n") | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment