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 .




 
#!/usr/bin/hopper
 
#include <hopper.h>
 
main:
ancho=500
alto=500
min real=-2
minReal=minreal
min complex=-2
max real = 2
max complex = 2
 
mandel=0,{ancho,alto}nanarray(mandel)
 
i=1,a2=0,b2=0,a=0,b=0,t1=0,t2=0
{","}toksep
tic(t1)
 
for(i=1,{i} le than (ancho),++i)
 
   for(j=1,{j} le than (alto),++j)
 
       {minreal} PLUS ( {max real}, minus (minReal), MUL BY ({i}minus(1)),  DIV BY ({ancho}minus(1))),mov(a) 
       {min complex} PLUS ( {maxcomplex}, minus (mincomplex), MULBY ({j} minus(1)),DIVBY ({alto} minus (1)) ),mov(b)
       a2=a,b2=b,brillo=1
 
       k=100
       __iterador__:
 
            sqrdiff(a,b), plus (a2)
            {2} mulby (a), mulby (b), plus (b2)
            mov(b),mov(a)
 
            if( {a,b} sqr add, gthan (4)) 
               brillo=0, jmp(__out__) 
            endif
            k--,jnz(__iterador__)
 
       __out__:
 
       [j,i]{brillo}put(mandel)
   next
next
toc(t1,t2)
{"TIME = ",t2,"\n"}print
{mandel,"mandel.dat"}save
{0}return
 