Just for fun ;-)
10 MODE 0:e=-1.3:FOR y%=0 TO 199:d=-2.4:FOR x%=0 TO 159:z=0:i=0:a%=0:WHILE a%<15 AND (z*z+i*i)<4:s=(z*z)-(i*i)+d:r=(2*i*z)+e:z=s:i=r:a%=a%+1:WEND:PLOT x%*4,y%*2,a%:d=d+0.0215:NEXT:e=e+0.013:NEXT
Be carefull, It's very slow...
Awesome +1 8)
Cool thing! Tried to add a palette set for green screen but then I got a "Line too long" :(
Anyway:
This is how it looks on green screen (Color routine: 1 FOR t=0 to 15:ink t,26-t*1.6:NEXT)
Well got it! For GT65 Greenies:
10 FOR t=0 TO 15:INK t,25-t*1.6:NEXT:MODE 0:e=-1.3:FOR y=0 TO 199:d=-2.4:FOR x=0 TO 159:z=0:i=0:a=0:WHILE a<15 AND (z*z+i*i)<4:s=z*z-i*i+d:r=2*i*z+e:z=s:i=r:a=a+1:WEND:PLOT x*4,y*2,a:d=d+0.0215:NEXT:e=e+0.013:NEXT
;)
Quote from: Devilmarkus on 13:58, 06 September 11
Well got it! For GT65 Greenies:
10 FOR t=0 TO 15:INK t,25-t*1.6:NEXT:MODE 0:e=-1.3:FOR y=0 TO 199:d=-2.4:FOR x=0 TO 159:z=0:i=0:a=0:WHILE a<15 AND (z*z+i*i)<4:s=z*z-i*i+d:r=2*i*z+e:z=s:i=r:a=a+1:WEND:PLOT x*4,y*2,a:d=d+0.0215:NEXT:e=e+0.013:NEXT
;)
congratulations !
I remember typing in a little BASIC program as a kid, to draw Mandelbrott, and then wait for several days before it was done.
Each day I'd come home from school and check how far it had gotten.
How about having a contest? Coders try to get the CPC to draw the Mandelbrott the fastest. Would like to see that. :)
Very impressive. Haven't dabbled in fractals for a while, so it was interesting to try and decipher the equations... :)
This is really good, it reminds me of an old ACU magazine where they had a competition for one-liners. Maybe there should be a new contest on here just for fun, to see what can be done in one line of code.
Nice one.
The example I have on my website which I ported from 16bit Turbo Pascal is slow while it's compiling the 4 Data files for the Colour points (all 64k of Information), so once them files (which I should have on my site) have been compiled, the thing takes about 9 minutes to draw, not bad for something done in a High Level Language, though I understand some Assembly versions have taken a bit of time to complete as well. I only real way I can think of for improving that time (besides saving it as a Screen and loading it in) is to store the colour data as a series of PEN Masks then poking those masks to screen, which is only approx 16Kb of Info.
So, how is the competition going? ;)
Who is coding such an algorithm which works as fast as possible?
Well, then. No competition entry as such and not in Basic, but an attempt to write a fast mandelbrot plotter in MODE 0 (normal and overscan screen).
It calcs the normal small mandelbrot in 24 seconds and the overscan in about 32-ish seconds. The zooms take a bit more.
MaVdelbrot – a fast Mandelbrot set calculation by MaV | The Amstrad CPC (http://www.octoate.de/wp/2012/09/13/mavdelbrot-a-fast-mandelbrot-set-calculation-by-mav/)
Download-Link:
http://www.octoate.de/wp/download/demos/mavdelbrot.zip (http://www.octoate.de/wp/download/demos/mavdelbrot.zip)
Enjoy!
Nice prod!
Now I want a rectangle,too, to select zoom area ;)
Move rectangle across the painted mandelbrot and press space to render selected region :)
Quote from: Devilmarkus on 21:58, 13 September 12
Now I want a rectangle,too, to select zoom area ;)
Move rectangle across the painted mandelbrot and press space to render selected region :)
That's not likely to happen, at least not in the near future.
You could zoom a little and select regions, but the program is designed for speed. As always it's a trade off of accuracy vs. speed; if you'd zoom into the plane a bit deeper the calculations would become inaccurate.
Besides, I've worked on it on and off in the last months, and would like to go on and do other stuff.
Oh this is lovely. Green, especially... and it's fast indeed!!
Wonder how this would go, if this were done in mode 2 and using SCR FILL BOX on a 80x25 txt display. The colour numbers could represent the encoded pens which are being gathered to show a pattern. Unsure if it would work or if it's a waste of time. ???
Quote from: mr_lou on 15:04, 06 September 11
How about having a contest? Coders try to get the CPC to draw the Mandelbrott the fastest. Would like to see that. :)
Quote from: MaV on 20:35, 13 September 12
Well, then. No competition entry as such and not in Basic, but an attempt to write a fast mandelbrot plotter in MODE 0 (normal and overscan screen).
Well, I have to say that the MaVdelbrot calculation is a lot faster today than it was when I last saw it a few weeks back.
You'd have to use a look-up table to get any faster, methinks!
EDIT:
Quote from: CP/M User on 11:50, 14 September 12
Wonder how this would go, if this were done in mode 2 and using SCR FILL BOX on a 80x25 txt display. The colour numbers could represent the encoded pens which are being gathered to show a pattern. Unsure if it would work or if it's a waste of time. ???
If you calculate every 8th x and y coordinate (or smaller, depending on speed), then there's no reason why you can't iterate further down past 16 (ie find more than 16 stipple patterns) and create a blocky mandelbrot image. From there, of course, you can zoom into the fractal, making a real-time mandelbrot zoomer on CPC in MODE 2. And, because the code wouldn't be that large, you could steal 32k for overscan; then there's no reason why the image couldn't be 96x34 characters. It would be interesting to see how fast a CPC could calculate the zoomer.
The same concept could be used for any of the other MODEs, you'd just need to program in a stipple on odd PENs, but it would look best on MODEs 1 or 2.
Very nice :o
Here is a 2 lines version, in mode 2 :
10 MODE 2:BORDER 0:INK 0,0:INK 1,26:PAPER 0:PEN 1:a$=" .:-;!/>)=&IH%*#":y=-13:WHILE y<12:k=1:FOR x=0 TO 79:PRINT MID$(a$,k,1);:i=0:r=0:k=0
20 j=r*r-i*i-2+x/25:i=2*r*i+y/10:r=j:k=k+1:IF j*j+i*i<11 AND k<16 THEN 20 ELSE NEXT:y=y+1:WEND:CALL &BB18
It takes about 7 minutes to finish...
Faster but I prefer the first one with beautiful colors. :P :P
I like the ASCII art.
Quote from: Nicolas Lecoq on 11:06, 27 July 19
Faster but I prefer the first one with beautiful colors. :P :P
You could cheat with CALL &BD1C: (ie. Print in Mode 2 but display in Mode 0)
10 MODE 2:CALL &BD1C:BORDER 0:INK 0,0:INK 1,26:PAPER 0:PEN 1:a$=" .:-;!/>)=&IH%*#":y=-13:WHILE y<12:k=1:FOR x=0 TO 79:PRINT MID$(a$,k,1);:i=0:r=0:k=0
20 j=r*r-i*i-2+x/25:i=2*r*i+y/10:r=j:k=k+1:IF j*j+i*i<11 AND k<16 THEN 20 ELSE NEXT:y=y+1:WEND:CALL &BB18
Quote from: demoniak on 10:37, 06 September 11
Just for fun ;-)
10 MODE 0:e=-1.3:FOR y%=0 TO 199:d=-2.4:FOR x%=0 TO 159:z=0:i=0:a%=0:WHILE a%<15 AND (z*z+i*i)<4:s=(z*z)-(i*i)+d:r=(2*i*z)+e:z=s:i=r:a%=a%+1:WEND:PLOT x%*4,y%*2,a%:d=d+0.0215:NEXT:e=e+0.013:NEXT
Be carefull, It's very slow...
A slight improvement:
10 MODE 0:e=-1.3:FOR y%=0 TO 398 STEP 2:d=-2.4:FOR x%=0 TO 636 STEP 4:z=0:i=z:c=z:b=z:a%=0:WHILE 15>a% AND 4>c+b:s=d+c-b:r=e+2*i*z:z=s:i=r:a%=a%+1:c=z*z:b=i*i:WEND:PLOT x%,y%,a%:d=d+0.0215:NEXT:e=e+0.013:NEXT
~77 minutes vs ~66 minutes 8)
Less than 0.1s here: https://benchmarko.github.io/CPCBasic/cpcbasic.html (https://benchmarko.github.io/CPCBasic/cpcbasic.html) ;D