Jump to content

Brownian tree: Difference between revisions

→‎{{header|Processing}}: It is not very Processing-like to have a long wait and draw a single frame of draw()... so now you see the tree growing (slowly).
(→‎{{header|Sidef}}: Fix link: Perl 6 --> Raku)
(→‎{{header|Processing}}: It is not very Processing-like to have a long wait and draw a single frame of draw()... so now you see the tree growing (slowly).)
Line 2,929:
 
void draw() {
for (int ix = 0; i < floor(random(width*height)); i++) {
int xy = floor(random(widthheight));
if (isTaken[x][y]) { continue; }
int y = floor(random(height));
return;
if (isTaken[x][y]) { continue; }
}
while (true) {
int xp = x + floor(random(-1, 2));
int ypxp = yx + floor(random(-1, 2));
int yyp = y + floor(random(height-1, 2));
boolean iscontained = (
0 <= xp && xp < width &&
0 <= ypxp && ypxp < heightwidth &&
0 <= xpyp && xpyp < width && height
);
if (iscontained && !isTaken[xp][yp]) {
x = xp;
y = yp;
continue;
} else }{
if (SIDESTICK || (iscontained && isTaken[xp][yp])) {
else {
if (SIDESTICK || (iscontained && isTaken[xpx][ypy])) {= true;
set(x, isTaken[x][y] =, true#FFFFFF);
set(x, y, #000000);
}
break;
}
else {break;
}
}
if (frameCount > width * height) noLoop();
}</lang>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.