1require 'complex' 2 3def mandelbrot? z 4 i = 0 5 while i<100 6 i += 1 7 z = z * z 8 return false if z.abs > 2 9 end 10 true 11end 12 13ary = [] 14 15(0..1000).each{|dx| 16 (0..1000).each{|dy| 17 x = dx / 50.0 18 y = dy / 50.0 19 c = Complex(x, y) 20 ary << c if mandelbrot?(c) 21 } 22} 23 24