Mandelbrot set

You are encouraged to solve this task according to the task description, using any language you may know.


Task

Generate and draw the Mandelbrot set.



Note that there are many algorithms to draw Mandelbrot set and there are many functions which generate it .




ZOOM = 100
MAX_ITER = 40
gfx.clear color.black
for y in range(0,200)
	for x in range(0,300)
		zx = 0
		zy = 0
		cx = (x - 200) / ZOOM
		cy = (y - 100) / ZOOM
		for iter in range(MAX_ITER)
			if zx*zx + zy*zy > 4 then break
			tmp = zx * zx - zy * zy + cx
			zy = 2 * zx * zy + cy
			zx = tmp
		end for
		if iter then
			gfx.setPixel x, y, rgb(255-iter*6, 0, iter*6)
		end if
	end for
end for