|
Post by Carl Gundel on May 16, 2020 18:41:09 GMT -5
I ported this from an Apple II program. It's a lot different now. I think this is fun. WARNING: I used GOTO 'Mandelbrot Set - in color, ported from and old Applesoft BASIC program startMS = time$("ms") scale = 2 'change this to 1, or 3 or whatever WindowWidth = 800 WindowHeight = 600 open "mandelbrot set" for graphics as #gr #gr "down" #gr "fill black" color$ = "darkpink red yellow green blue darkpink red yellow green blue black" for a = 1 to 25000 [innerLoop] x = int(rnd(1)*279*scale) 'for x = 0 to 279 y = int(rnd(1)*95*scale) 'for y = 0 to 95 x1 = x / 280 * 3 - 2 : y1 = y / 191 * 2 - 1 i = 0 : s = x1 : t = y1 while i < 20 and s * s + t * t < 4 s1 = s * s - t * t + x1 t = 2 * s * t + y1:s = s1: i = i + 1 wend c = i/2 if x * scale > 800 or y * scale > 600 then counter = counter + 1 lastc = c goto [innerLoop] else if lastc <> c then #gr "color "; word$(color$, int(c) + 1) #gr "size "; max(1, int(((11-c) * scale) ^ 0.8 )) #gr "set "; x*scale; " "; y*scale : #gr "set "; x*scale; " "; (191-y)*scale end if lastc = c next a print "done in "; time$("ms")-startMS; " milliseconds" print counter wait
|
|
|
Post by Brandon Parker on May 16, 2020 19:40:15 GMT -5
Awesome!! You also forgot to add the "TrapClose" statement and associated "Close" command for the #gr window. 'Mandelbrot Set - in color, ported from and old Applesoft BASIC program startMS = time$("ms") scale = 2 'change this to 1, or 3 or whatever WindowWidth = 800 WindowHeight = 600 open "mandelbrot set" for graphics as #gr #gr "TrapClose [quit]" #gr "down" #gr "fill black" color$ = "darkpink red yellow green blue darkpink red yellow green blue black" for a = 1 to 25000 [innerLoop] x = int(rnd(1)*279*scale) 'for x = 0 to 279 y = int(rnd(1)*95*scale) 'for y = 0 to 95 x1 = x / 280 * 3 - 2 : y1 = y / 191 * 2 - 1 i = 0 : s = x1 : t = y1 while i < 20 and s * s + t * t < 4 s1 = s * s - t * t + x1 t = 2 * s * t + y1:s = s1: i = i + 1 wend c = i/2 if x * scale > 800 or y * scale > 600 then counter = counter + 1 lastc = c goto [innerLoop] else if lastc <> c then #gr "color "; word$(color$, int(c) + 1) #gr "size "; max(3, int(((11-c) * scale) ^ 0.8 )) #gr "set "; x*scale; " "; y*scale : #gr "set "; x*scale; " "; (191-y)*scale end if lastc = c next a print "done in "; time$("ms")-startMS; " milliseconds" print counter wait
[quit] Close #gr End {:0) Brandon Parker
|
|