2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

例のキヨシチェックを Ruby のワンライナーで書いてみる

Last updated at Posted at 2016-03-11

こんな感じですかね。

ruby -e 's = ""; until s[/(ズン){5}ド/] do print c = %w(ズン ドコ).sample; s += c end; puts "キ・ヨ・シ!"'
実行結果
ズンズンドコドコズンドコドコドコズンドコドコドコドコドコズンズンズンズンズンドコキ・ヨ・シ!

元ネタ

Javaの講義、試験が「自作関数を作り記述しなさい」って問題だったから「ズン」「ドコ」のいずれかをランダムで出力し続けて「ズン」「ズン」「ズン」「ズン」「ドコ」の配列が出たら「キ・ヨ・シ!」って出力した後終了って関数作ったら満点で単位貰ってた

https://mobile.twitter.com/kumiromilk/status/707437861881180160

参考

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?