Return to Snippet

Revision: 14595
at June 7, 2009 13:16 by Zufolek


Initial Code
1 SCREEN 1
3 PRINT "Basic Mandelbrot Explorer":PRINT
4 PRINT "2007-2009 Zufolek":PRINT
5 PRINT "Controls:"
6 PRINT "8 - Up":PRINT "2 - Down"
7 PRINT "4 - Left":PRINT "6 - Right"
9 PRINT "5 - Zoom In":PRINT "0 - Zoom Out"
11 PRINT "Space Bar - Show Coordinates"
13 PRINT "i - Change # of Iterations"
11 PRINT "Esc - Exit"
15 PRINT:PRINT "More iterations means higher quality but slower display"
17 PRINT:PRINT "Press any key to start"
19 IF INKEY$="" THEN 19
20 N=40
30 OX=2:OY=1:OU=100
50 CLS
100 D=N/4
400 FOR X = 0 TO 319
500  FOR Y = 0 TO 199
505   X1=X/OU-OX:XX=X1
510   Y1=Y/OU-OY:YY=Y1
515   X2 = XX*XX
520   Y2 = YY*YY
525   IT = 0
535   IF X2 + Y2 > 4  OR  IT = N  THEN 580
540   YY = 2*XX*YY + Y1
545   XX = X2 - Y2 + X1
550   X2 = XX*XX
555   Y2 = YY*YY
560   IT = IT + 1
565   GOTO 535
580   A=IT-INT(IT/4)*4
600   PSET(X,Y),A
700  NEXT Y:Z$=INKEY$:IF Z$>"" THEN 854
800 NEXT X
849 IF INKEY$>"" THEN 849
850 Z$=INKEY$
852 IF Z$="" THEN 850
854 IF Z$="4" THEN OX=OX+80/OU:GOTO 400
856 IF Z$="6" THEN OX=OX-80/OU:GOTO 400
858 IF Z$="8" THEN OY=OY+50/OU:GOTO 400
860 IF Z$="2" THEN OY=OY-50/OU:GOTO 400
862 IF Z$="5" THEN OU=OU*2:OX=OX-160/OU:OY=OY-100/OU:GOTO 400
864 IF Z$="0" THEN OX=OX+160/OU:OY=OY+100/OU:OU=OU*.5:GOTO 400
866 IF Z$="i" THEN LOCATE 1,1:INPUT "Iterations?",N:GOTO 100
868 IF Z$=" " THEN LOCATE 1,1:PRINT "(";160/OU-OX;",";100/OU-OY;") Zoom";OU/100:GOTO 850
890 IF Z$=CHR$(27) THEN END
899 GOTO 850

Initial URL

                                

Initial Description

                                

Initial Title
GW-BASIC Mandelbrot Set fractal explorer

Initial Tags

                                

Initial Language
Other