Skip to content

Instantly share code, notes, and snippets.

@tenten0213
Last active August 29, 2015 14:09
Show Gist options
  • Save tenten0213/f1b2ea04b066a9d8b4df to your computer and use it in GitHub Desktop.
Save tenten0213/f1b2ea04b066a9d8b4df to your computer and use it in GitHub Desktop.
ジョン・ボン・ジョヴィ 元ネタ: https://twitter.com/yagiyyyy/status/473405016540053504
def gen_bonjovi
bonjovi_list = ["ボ", "ン", "ジョ", "ヴィ"]
bonjovi = []
count = 0
# 無限リスト作る
# 6文字取ってきて2文字毎に中点区切る
# もし正しいボン・ジョヴィならbreak
# 中点でるごと?のカウントも
loop do
print bonjovi.push(bonjovi_list[rand(4)]).each.lazy.map { |badname| count=count+1; badname}
.first(10)
end
puts "#{count} Bon Jovis"
puts "_人人人人人人人人人人人人人人_
> You Give Love a Bad Name <
 ̄Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y ̄"
end
gen_bonjovi
@tenten0213
Copy link
Author

配列の要素を極力少ない状態に保つバージョンも追加。
上のやつだと文字列の結合と出力に時間がかかるし、メモリも食いそう。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment