或るゲームのくじの確率

ゲームのくじの確率を計算して欲しいです・当たりは14%です... - Yahoo!知恵袋
Yahoo!知恵袋で上のような問題があった。最初は手計算でやろうと思ったが、非常に面倒な計算になるので挫折。で、Ruby で強引に計算してみた。結果は 8.06%ほどと出た。さて、どうなのか。

def one_set
  count = 0
  10.times do
    count += 1 if Random.rand < 0.14
  end
  count
end

def three_sets
  count = 0
  3.times do
    c = one_set
    c = 3 if c >= 3
    count += c
  end
  count >= 7
end

num = 1000_0000; count = 0
num.times do
  count += 1 if three_sets
end
puts (count / num.to_f)


追記:
当ブログのこのエントリで厳密な値を求めています。参考までに。