Skip to content

Instantly share code, notes, and snippets.

@izumin5210
Last active April 23, 2016 08:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save izumin5210/5c48f0adef9296e311efcbb47abe6fe8 to your computer and use it in GitHub Desktop.
Save izumin5210/5c48f0adef9296e311efcbb47abe6fe8 to your computer and use it in GitHub Desktop.
ズンドコペアプロのライブコーディングで書いたやつ
# 詰めると1行(68文字)
# s="";(print c=%w(ズン ドコ).sample;s+=c)until s[/(ズン){4}ド/];puts"キ・ヨ・シ!”
# きれいに書くとこんなかんじ
dic = %w(ズン ドコ)
msg = ""
# 「ズンドコが完成していない」間はループが回る
until msg[/(ズン){4}ド/]
# ちゃんとした正規表現マッチング
# until /(ズン){4}ド/ =~ msg
# 正規表現つかわないパターン
# until msg.end_with?("#{'ズン' * 4}ドコ")
# ズンかドコを取り出す
chunk = dic.sample
print chunk
# ズンドコを記録する
msg += chunk
end
puts "キ・ヨ・シ!”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment