Brownian tree: Difference between revisions

no edit summary
(Created page with '{{Wikipedia|Brownian_tree|en}} Category:Raster graphics operations {{task|Fractals}}Generate and draw a Brownian Tree. =={{header|C}}== This code uses …')
 
No edit summary
Line 29:
py = rand() % SIZE;
 
hitwhile = 0;(1){
while (!hit){
// randomly choose a direction
dx = rand() % 3 - 1;
Line 41 ⟶ 40:
}else if (world[py + dy][px + dx] != 0){
// bumped into something
hit = 1;
world[py][px] = 1;
hit = 1break;
}else{
py += dy;
Line 57 ⟶ 56:
int x, y;
memset(world, 0, sizeof(int) * SIZE * SIZEworld);
srand((unsigned)time(NULL));
 
Anonymous user