SCREEN 12
DEFDBL A-Z
A% = 640 'Resolucion Horizontal
B% = 480 'Resolucion Vertical
M% = 200 'Numero de interaciones por punto
PMIN = -2.25 ' Plano complejo
PMAX = 0.75 'Plano complejo
QMIN = -1.5 'Plano complejo
QMAX = 1.5 'Plano complejo
CMAX% = 10000 'Nivel de detalle
DP = (PMAX - PMIN) / (A% - 1)
DQ = (QMAX - QMIN) / (B% - 1)
FOR NP% = 0 TO A% - 1
FOR NQ% = 0 TO B% - 1
P = PMIN + NP% * DP
Q = QMIN + NQ% * DQ
K% = 0
X = 0
Y = 0
610 '
XN = (X * X) - (Y * Y) + P
Y = 2 * X * Y + Q
X = XN
K% = K% + 1
IF (X * X) + (Y * Y) > M% THEN C% = K%: GOTO 690
IF K% = CMAX% THEN C% = 0: GOTO 690
680 GOTO 610
690 PSET (NP%, NQ%), C%
NEXT NQ%
NEXT NP%
720 A$ = INKEY$: IF A$ = "" THEN 720
2 x& = (x& + 123) MOD 64000
3 im2 = im * im
4 IF iter% THEN im = 2 * re * im + (CSNG(x& \ 320) / 100 - 1) ELSE im = 0
5 IF iter% THEN re = re * re - im2 + (CSNG(x& MOD 320) / 120 - 1.9) ELSE re = 0
6 iter% = iter% + 1
7 IF ABS(re) + ABS(im) > 2 OR iter% > 254 THEN PSET (x& MOD 320, x& \ 320), iter% ELSE GOTO 3
8 IF LEN(INKEY$) = 0 THEN GOTO 1
-----------------------------------------------------------------------------------------
WINDOW (-2, 1.5)-(2, -1.5)
FOR x0 = -2 TO 2 STEP .01
FOR y0 = -1.5 TO 1.5 STEP .01
x = 0
y = 0
iteration = 0
maxIteration = 1000
WHILE (x * x + y * y <= (2 * 2) AND iteration < maxIteration)
xtemp = x * x - y * y + x0
y = 2 * x * y + y0
x = xtemp
iteration = iteration + 1
WEND
IF iteration <> maxIteration THEN
c = iteration
ELSE
c = 0
END IF
PSET (x0, y0), c + 32
NEXT
NEXT