Login
Back to forumSee the full topicGo to last reply

Posted By

MMS
on 2024-04-01
17:31:46
 Re: Simple but nice BASIC code examples

3) An other nice example of compact, recursive, fractal drawing routine.
UPDATE: strange, but when I edited, it was a correct legit line, but after saving it, the end of long line disappeared. Frankly speaking I dunno what's happening :-)
Thanks George for the warning. I try to correct it somehow.

UPDATE2: yeah, it seems the forum is a "little too smart" creating control characters from the code. I added spaces everywhere.
If you still cannot get it to work, please refer to the Program code JPG I attach to the end...

It is made for C64 in Simon's BASIC. It is a slightly faster dialect than V3.5, but very similar logic.
I had a feeling Commodore took some ideas from Simons' BASIC (released in 1983) as it is also released by Commodore on cartridge.
I believe the cartridge should have been added to the C64C version free next to the machine in 1986, it extended the access to sound and graphics of the C64 machine so much.

Original code is at 62'er Magazine Fractal Berge - special issue SH07 S.124 from G.Paret
https://ia903108.us.archive.org/6/items/64er_sonderheft_1986_07/64er_sonderheft_1986_07.pdf

That 62'er has a lot of goodies for Commodore 16 too, memory maps, handling of windows, etc.
Too bad my German is not so great.

The 264 version (it is so compact it should run on C16 too):
10 graphic3,1:color0,1:color1,1:
20 color1,10,5:color2,8,6: color3,10,3:xm=105:ym=105:rem recolor
30 xc=0.77:yc=0.6:T=22:S=40
35 xl=-1.4:xr=1.4:yo=-0.9:yu=1.2
40 dx=(xr-xl)/xm:dy=(yu-yo)/ym
50 for n=0 to ym:y1=yo+n*dy:for m=0toxm:x=xl+m*dx:y=y1:k=0
60 x2=x*x:y2=y*y:y=2*x*y-yc:x=x2-y2-xc:k=k+1
65 if ( k< t ) and (x2+y2 < s) then goto 60
70 u=m+53-n/2:u1=u+1:v=n+80:v1=v-3*(k-1)
75 draw3,u,v to u,v1:draw2,u1,v to u1,v1:draw1,u,v1 to u1,v1
80 next:next
90 getkey a$

In line 20 you can recolor it to your taste. With the original C64 colors did not look so great. happy

The BASIC3.5 version without speedup certainly needs patience. With speedup too happy
(I can run my YAPE at max 650%, good candidate for compilers)







Back to top


Copyright © Plus/4 World Team, 2001-2024