1rem Mandelbrot example thanks to Joel Kahn
2
3fastgraphics
4
5editvisible false
6outputvisible false
7
8graphsize 800,800
9refresh
10kt=50:m=4.0
11xmin=2.1:xmax=-0.6:ymin=-1.5:ymax=1.5
12dx=(xmax-xmin)/graphwidth:dy=(ymax-ymin)/graphheight
13
14for x=0 to graphwidth
15jx=xmin+x*dx
16for y=0 to graphheight
17jy=ymin+y*dy
18k=0:wx=0.0:wy=0.0
19
20MainCalculation:
21tx=wx*wx-(wy*wy+jx)
22ty=2.0*wx*wy+jy
23wx=tx
24wy=ty
25r=wx*wx+wy*wy
26k=k+1
27if r<=m and k<kt then goto MainCalculation
28
29color darkblue
30if k > 5 then color darkblue
31if k > 10 then color blue
32if k > 15 then color darkgreen
33if k > 20 then color green
34if k > 25 then color darkred
35if k > 30 then color red
36if k > 35 then color darkpurple
37if k > 40 then color purple
38if k > 45 then color black
39plot x,y
40next y
41refresh
42next x
43
44