mirror of
https://github.com/irmen/prog8.git
synced 2024-12-23 09:32:43 +00:00
32 lines
718 B
QBasic
32 lines
718 B
QBasic
100 REM MANDELBROT GFX - BASIC VERSION FOR COMMANDERX16
|
|
110 REM MANDELBROT COORDINATES
|
|
120 XL=-2.000:XU=0.500
|
|
130 YL=-1.100:YU=1.100
|
|
140 MI%=16 :REM MAXIMUM ITERATIONS
|
|
150 WI%=256:HI%=200 :REM SCREEN DIMENSIONS
|
|
160 DX=(XU-XL)/WI%
|
|
170 DY=(YU-YL)/HI%
|
|
200 SCREEN $80:TI$="000000"
|
|
500 REM MAIN LOOP
|
|
520 X0=0:Y0=0:GOSUB2000
|
|
530 FOR YY=0 TO HI%-1
|
|
540 Y0=YL+DY*YY
|
|
610 FOR XX=0 TO WI%-1
|
|
620 X0=XL+DX*XX
|
|
700 REM CALCULATE MANDELBROT
|
|
710 X=0:Y=0:IT%=0
|
|
720 X2=0:Y2=0
|
|
730 XY=X*Y
|
|
740 X=X2-Y2+X0
|
|
750 Y=2*XY+Y0
|
|
760 IT%=IT%+1
|
|
770 X2=X*X:Y2=Y*Y
|
|
780 IF (X2+Y2 <= 4) AND (IT% < MI%) THEN GOTO 730
|
|
790 PSET XX,YY,MI%-IT%
|
|
800 NEXT XX
|
|
810 GOSUB2000
|
|
820 NEXT YY
|
|
1000 GOTO 1000
|
|
2000 REM OUTPUT TIME SPENT
|
|
2010 PRINT CHR$(19)SPC(33)TI$:RETURN
|