Created
March 17, 2016 01:09
-
-
Save KazuCocoa/344c9f4730aa30d5510c 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
defmodule Znd do | |
@z "ズン" | |
@d "ドコ" | |
@k "キ・ヨ・シ" | |
def kiyoshi, do: [] |> kiy | |
defp kiy(zd) when zd == [@d, @z, @z, @z, @z], do: [@k|zd] |> Enum.reverse |> Enum.join | |
defp kiy(zd) when length(zd) > 5 do | |
{h, t} = zd |> Enum.split(5) | |
t |> List.to_string |> IO.puts | |
h |> kiy | |
end | |
defp kiy(zd), do: [Enum.random([@z, @d])|zd] |> kiy | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment