! MANDELBROT ZOOM PROGRAM:

!

SET MODE "graphics"

!

ASK PIXELS hpix,vpix

!

LET ratio=hpix/vpix

!

SET WINDOW -1.5*ratio,2.5*ratio,-2,2

!

OPEN #1: SCREEN .5,1,.25,.75

!

WINDOW #0

!

SET COLOR "GREEN"

!

BOX CIRCLE -2,2,-2,2

!

PLOT -2,0;2,0

PLOT 0,-2;0,2

!

SET COLOR "BLACK"

!

FOR j=-300 to 300

!

FOR k = -300 to 0

!

LET x = 0

!

LET y = 0

!

FOR n=1 to 30

!

LET x1 = x*x - y*y + j/150

!

LET y1 = 2*x*y + k/150

!

LET r2 = x1*x1 + y1*y1

!

IF r2>4 THEN EXIT FOR

!

LET x = x1

!

LET y = y1

!

NEXT n

!

IF n=31 THEN PLOT j/150,k/150

IF n=31 THEN PLOT j/150,-k/150

!

NEXT k

!

NEXT j

PRINT "CLICK TO SELECT A VALUE FOR c"

BOX KEEP -2,1,-2,2 IN MAND$

! !

DO

WINDOW #0

!

SET COLOR "GREEN"

DO

GET MOUSE cr,ci,s

IF cr<.6 THEN BOX CIRCLE cr-.1,cr+.1,ci-.1,ci+.1

BOX SHOW MAND$ AT -2,-2

LOOP UNTIL s=2

!

PRINT "You have chosen: c= ";cr;" + i*";ci

PRINT

!

BOX CIRCLE cr-.1,cr+.1,ci-.1,ci+.1

!

WINDOW #1

CLEAR

SET WINDOW -.1*ratio,.1*ratio,-.1,.1

SET COLOR "GREEN"

BOX CIRCLE -.1,+.1,-.1,+.1

PLOT

SET COLOR "BLACK"

! !

FOR j=-.1 to +.1 step .2/300

!

FOR k = -.1 to .1 step .2/300

!

LET x = 0

!

LET y = 0

!

FOR n=1 to 30

!

LET x1 = x*x - y*y + cr +j

!

LET y1 = 2*x*y + ci + k

!

LET r2 = x1*x1 + y1*y1

!

IF r2>4 THEN EXIT FOR

!

LET x = x1

!

LET y = y1

!

NEXT n

!

IF (n=31 AND (j*j+k*k<.01)) THEN PLOT j,k

!

NEXT k

!

NEXT j

!

LOOP

!

END