LoginSignup
3
2

More than 5 years have passed since last update.

「明日・やろうは・バカ・やろう」をランダムに表示し「明日やろうはバカやろう」が完成したら煽ってくるプログラム

Last updated at Posted at 2017-09-04

こちらの記事を見たので真似してノリで書いてみました。
言語はRubyです、かなりシンプルになってます。

プログラム

# 明日やろうはバカやろう で煽るプログラム

ary = ["明日", "やろうは", "バカ", "やろう"]
moji = ""
loop do
  word = ary.sample
  moji << word
  print word

  break if moji =~ /明日やろうはバカやろう/
end

puts <<EOT
"#{moji.length}文字で煽られました。"
"_人人人人人人人人人人人_"
">明日やろうはバカやろう<"
" ̄Y^Y^Y^Y^Y^Y^Y^Y^Y^Y ̄"
EOT

特筆することはないです。。。
Rubyの基本を使って簡単にかけます。

おかしなところがあればコメントお願いします

※ コメントいただいた修正をいたしました。 @scivola さんありがとうございます!

3
2
2

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
3
2