Thank both of You for the tips. The first concerns a completely different way of generating the fractal, but it is interesting too. Second, that the ifs system, just like in my program. I have read the code and I see that I can improve my one:
'Sierpinski triangle IFS method
graphic #Sierpinski, 500, 500
read j
p1 = 0
for i = 1 to j
read a, b, c, d, e, f, p0
a(i) = a
b(i) = b
c(i) = c
d(i) = d
e(i) = e
f(i) = f
p1 = p1 + p0
p(i) = p1
next i
for w = 1 to 500000
p2 = rnd(1)
if p2 <= p(1) then k = 1
if p2 > p(1) and p2 <= p(2) then k = 2
if p2 > p(2) and p2 <= p(3) then k = 3
'One can use instead:
'if p1 <= p(3) then k = 3
'if p1 <= p(2) then k = 2
'if p1 <= p(1) then k = 1
x1 = a(k) * x + b(k) * y + e(k)
y = c(k) * x + d(k) * y + f(k)
x = x1
#Sierpinski set(250 * x, 250 * y)
next w
render #Sierpinski
end
data 3
data 0.5, 0, 0, 0.5, 0.0, 0.0, 0.33
data 0.5, 0, 0, 0.5, 1.0, 0.0, 0.33
data 0.5, 0, 0, 0.5, 0.5, 0.5, 0.34