Help us understand the problem. What is going on with this article?

リズムに乗ってズンドコキヨシ♪ with Ruby

More than 3 years have passed since last update.

ふつうの(?)ズンドコキヨシは一瞬で結果が出てキヨシのありがたみが感じられないので、
リズムに乗って表示されるようにした。

最初から"ドコ"が出てきたときの切なさ、
"ズンズンズンズン"と来て最後も"ズン"だったときの絶望感、
"ドコ"始まりがしばらく続いた後にやってきた"ズン"始まりの救世主感、
そして"キ・ヨ・シ!"の爽快感(想像以上に気持ちいい)。

全ては実行した者のみが味わえる極上のひととき。

def zundoko
  loop do
    n = rand(32)
    s = ("%05b" % n).gsub(/0/, 'ズン').gsub(/1/, 'ドコ')
    r = [0, 1.0, 0, 0.5, 0, 0.5, 0, 0.5, 0.25, 0.25]
    print_with_rythm s, r

    if n == 1
      print_with_rythm "キ・ヨ・シ!", [0, 0.25, 0, 0.25, 0, 1.0]
      break
    end

    puts
  end
end

def print_with_rythm(s, r)
  s.split(//).zip(r).each do |c, w|
    print c
    sleep(w)
  end
end

zundoko

リズムに乗る関係上、5個区切りの判定に。
そうなると、"ズン"->0, "ドコ"->1と考えたときに、rand(32)が1を出すのを待つのと意味合い的に同じになるじゃん、ってことで、それっぽくズンドコを作ってみた。

Kta-M
fusic
個性をかき集めて、驚きの角度から世の中をアップデートしつづける。
https://fusic.co.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした