Last active
August 29, 2015 14:09
-
-
Save tenten0213/f1b2ea04b066a9d8b4df to your computer and use it in GitHub Desktop.
ジョン・ボン・ジョヴィ 元ネタ: https://twitter.com/yagiyyyy/status/473405016540053504
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
def gen_bonjovi | |
bonjovi = %w(ボ ン ジョ ヴィ)] | |
random_jovis = [] | |
count = 0 | |
while(random_jovis.last(8).join != "ジョン・ボン・ジョヴィ") do | |
count += 1 | |
random_jovis.push("・") if count % 2 == 0 | |
random_jovis.push(bonjovi.sample) | |
end | |
puts random_jovis.join | |
puts "\n\n #{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 |
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
def gen_bonjovi | |
bonjovi = %w(ボ ン ジョ ヴィ) | |
expect = %w(ジョ ン ・ ボ ン ・ ジョ ヴィ) | |
random_jovis = [] | |
count = 0 | |
while(random_jovis != expect) do | |
count += 1 | |
random_jovis.push("・") if count % 2 == 0 | |
random_jovis.push(bonjovi.sample) | |
print random_jovis.shift(random_jovis.size - expect.size).join if random_jovis.size > expect.size | |
end | |
print random_jovis.join | |
puts "\n\n #{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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
配列の要素を極力少ない状態に保つバージョンも追加。
上のやつだと文字列の結合と出力に時間がかかるし、メモリも食いそう。