0
0

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 3 years have passed since last update.

sketchupでruby その2

Posted at

#概要

sketchupでrubyやってみた。
zundokoやってみた。

#サンプルコード

def zundoko
   words = []
   def zd
      word = (rand(2) == 0) ? "zun" : "doko"
      puts word
      return word
   end
   while true
      words.push zd
      ans = words[-5, 5]
      if ans == ["zun", "zun", "zun", "zun", "doko"]
         puts "kiyosi!"
         break
      end
   end
end

#実行結果

zundoko
zun
doko
doko
doko
doko
doko
zun
zun
zun
doko
zun
doko
doko
doko
doko
doko
doko
doko
doko
zun
zun
doko
zun
doko
zun
zun
doko
zun
doko
zun
zun
zun
doko
zun
zun
zun
zun
zun
doko
kiyosi!
nil

以上。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?