SET MODE "graphics"

ASK PIXELS hpix,vpix

LET ratio=hpix/vpix

SET WINDOW -2*ratio,2*ratio,-2,2

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,2,-2,2 IN MAND$

OPEN #1: SCREEN .6,1,.3,.7

DO

WINDOW #0

BOX SHOW MAND$ AT -2,-2

GET POINT cr,ci

SET COLOR "GREEN"

BOX DISK cr-.02,cr+.02,ci-.02,ci+.02

WINDOW #1

CLEAR

SET WINDOW -2*ratio,2*ratio,-2,2

SET COLOR "GREEN"

PRINT " c= ";cr;" + i*";ci

PLOT -2,0;2,0

PLOT 0,-2;0,2

PLOT -2,-2;2,-2;2,2;-2,2;-2,-2

SET COLOR "BLACK"

FOR j=-150 to 150

FOR k = -150 to 150

LET x = j/75

LET y = k/75

FOR n=1 to 20

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

LET y1 = 2*x*y + ci

LET r2 = x1*x1 + y1*y1

IF r2>4 THEN EXIT FOR

LET x = x1

LET y = y1

NEXT n

IF n=21 THEN PLOT j/75,k/75

NEXT k

NEXT j

DO

GET MOUSE x,y,s

LOOP UNTIL s=2

LOOP

END