「ぼくゴリラ ウホホイウッホ ウホホホホ ウッホホウッホ ウホホホホーイ」 第57回左千夫短歌大会の市長賞作品に感動が抑えきれないので、ウホホ変換スクリプトを組むことにした。 まず元作品から状態遷移図を作成。矢印のそばにある数字は遷移確率。 そのままコードに落とす。 class Array def any; self[rand(self.size)] end end module Uho MASTERPIECE = 'ウホホイウッホ ウホホホホ ウッホホウッホ ウホホホホーイ' DEFAULT_CHAR = 'ウ' class Converter def initialize(masterpiece=MASTERPIECE) @char_table = {} masterpiece.split(' ').each do |sentence| chars = sentence.split('
![マルコフ過程なウホホイウッホ - ずっと君のターン](https://cdn-ak-scissors.b.st-hatena.com/image/square/cd0e08c626b8f90cf33f8c9bd519030f88f38871/height=288;version=1;width=512/https%3A%2F%2Fcdn-ak.f.st-hatena.com%2Fimages%2Ffotolife%2Ft%2Ftechnohippy%2F20090120%2F20090120002509.gif)