Brownian tree: Difference between revisions
Content added Content deleted
(Added compression when saving.) |
|||
Line 921: | Line 921: | ||
[https://easylang.online/apps/_brownian-tree.html Run it] |
[https://easylang.online/apps/_brownian-tree.html Run it] |
||
<lang> |
<lang>set_rgb 0 1 1 |
||
len f[] 200 * 200 |
len f[] 200 * 200 |
||
move_pen 50 50 |
move_pen 50 50 |
||
Line 928: | Line 928: | ||
n = 9000 |
n = 9000 |
||
while i < n |
while i < n |
||
repeat |
|||
x = random 200 |
|||
y = random 200 |
|||
⚫ | |||
x = random 200 |
x = random 200 |
||
y = random 200 |
y = random 200 |
||
⚫ | |||
. |
. |
||
while |
while 1 = 1 |
||
xo = x |
xo = x |
||
yo = y |
yo = y |
||
Line 940: | Line 939: | ||
y += random 3 - 1 |
y += random 3 - 1 |
||
if x < 0 or y < 0 or x >= 200 or y >= 200 |
if x < 0 or y < 0 or x >= 200 or y >= 200 |
||
break 1 |
|||
. |
|||
if f[y * 200 + x] = 1 |
|||
move_pen xo / 2 yo / 2 |
|||
draw_rect 0.5 0.5 |
|||
f[yo * 200 + xo] = 1 |
|||
i += 1 |
|||
if i mod 16 = 0 |
|||
set_rgb 0.2 + i / n 1 1 |
|||
sleep 0 |
|||
⚫ | |||
x = -1 |
|||
. |
. |
||
⚫ | |||
. |
. |
||
. |
. |