Sierpinsky fractal (re-coded)

Post Reply
Henko
Posts: 835
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Sierpinsky fractal (re-coded)

Post by Henko »

I like compact program code. Here is Sierpinsky’s fractal by Dalede in the Examples directory.

Code: Select all

'     Sierpinski fractal maker
'     by Dalede (re-coded by Henko)
graphics ! get screen size sw,sh ! sc=screen_scale()
sw*=sc ! sh*=sc ! x=sw/2 ! y=sh/2
for count=1 to 200000
  r=rnd(3) ! x=(x+r*sw/2)/2 ! y=(y+even(r)*sh)/2
  draw pixel x,y color rnd(1),x/sw,y/sh
  next count
end
IMG_1371.png
IMG_1371.png (715.11 KiB) Viewed 82 times

Post Reply