Brownian tree: Difference between revisions

m
Line 787:
end;
end;</lang>
 
=={{header|Easylang.online}}==
 
[https://easyprog.online/ide/run.html?code=color%20275%0Alen%20f%5B%5D%20200%20%2A%20200%0Amove%20100%20100%0Arect%200.5%200.5%0Af%5B100%20%2A%20200%20%2B%20100%5D%20%3D%201%0An%20%3D%209000%0Awhile%20i%20%3C%20n%0Ax%20%3D%20random%20200%0Ay%20%3D%20random%20200%0Awhile%20f%5By%20%2A%20200%20%2B%20x%5D%20%3D%201%0Ax%20%3D%20random%20200%0Ay%20%3D%20random%20200%0A.%0Awhile%20x%20%3C%3E%20-1%0Axo%20%3D%20x%0Ayo%20%3D%20y%0Ax%20%2B%3D%20random%203%20-%201%0Ay%20%2B%3D%20random%203%20-%201%0Aif%20x%20%3C%200%20or%20y%20%3C%200%20or%20x%20%3E%3D%20200%20or%20y%20%3E%3D%20200%0Ax%20%3D%20-1%0Aelse%0Aif%20f%5By%20%2A%20200%20%2B%20x%5D%20%3D%201%0Amove%20xo%20/%202%20yo%20/%202%0Arect%200.5%200.5%0Af%5Byo%20%2A%20200%20%2B%20xo%5D%20%3D%201%0Ai%20%2B%3D%201%0Aif%20i%20mod%2016%20%3D%200%0Acolor_red%200.2%20%2B%20i%20/%20n%0Asleep%200%0A.%0Ax%20%3D%20-1%0A.%0A.%0A.%0A. Run it]
 
<lang>color 275
len f[] 200 * 200
move 100 100
rect 0.5 0.5
f[100 * 200 + 100] = 1
n = 9000
while i < n
x = random 200
y = random 200
while f[y * 200 + x] = 1
x = random 200
y = random 200
.
while x <> -1
xo = x
yo = y
x += random 3 - 1
y += random 3 - 1
if x < 0 or y < 0 or x >= 200 or y >= 200
x = -1
else
if f[y * 200 + x] = 1
move xo / 2 yo / 2
rect 0.5 0.5
f[yo * 200 + xo] = 1
i += 1
if i mod 16 = 0
color_red 0.2 + i / n
sleep 0
.
x = -1
.
.
.
.</lang>
 
=={{header|Factor}}==
2,083

edits