Sierpinski fractal maker sample

Post Reply
Dalede
Posts: 131
Joined: Fri Dec 28, 2012 4:00 pm
Location: Grass Valley, CA, USA
Contact:

Sierpinski fractal maker sample

Post by Dalede »

rem Sierpinski fractal maker
def screenwidth=screen_width()
def screenheight=screen_height()

x=ScreenWidth/2
y=ScreenHeight/2
graphics
loop:
r=rnd(3)+1
ux=ScreenWidth/2
uy=0
IF r=1 THEN
ux=0
uy=ScreenHeight
ENDIF
IF r=2 THEN
ux=ScreenWidth
uy=ScreenHeight
ENDIF
x=(x+ux)/2
y=(y+uy)/2
z=rnd(1)
draw COLOR z,x/ScreenWidth,y/ScreenHeight
draw Pixel x,y
GOTO loop

This is because mr. kibernetik likes fractals. It was lifted and modified from the misoft forum. I own both programs. This one is faster in this snippet. In all fairness you need to set the point size to one on the misoft version.

Enjoy
Dale

User avatar
Mr. Kibernetik
Site Admin
Posts: 4787
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Sierpinski fractal maker sample

Post by Mr. Kibernetik »

Very nice working program!

P.S. for those who will want to upload it to their BASIC using Dropbox, I attach your code as a text file here
Attachments
sierpinski.txt
(360 Bytes) Downloaded 522 times

User avatar
Mr. Kibernetik
Site Admin
Posts: 4787
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Sierpinski fractal maker sample

Post by Mr. Kibernetik »

Screenshot of this fractal:
Photo 24.03.13, 11 11 55.png
Photo 24.03.13, 11 11 55.png (220.78 KiB) Viewed 3692 times

Post Reply