int[][] blocks;
int num = 50;
int bsize = 10;
void setup(){
size(500, 500, P3D);
blocks = new int[num][num];
for(int x = 0; x < num; x++){
for(int y = 0; y < num; y++){
blocks[x][y] = 0;
}
}
stroke(0);
fill(255);
}
void draw(){
background(255);
lights();
translate(width / 2, height / 2, -200);
rotateX(PI / 3);
rotateZ(PI / 4);
for(int x = 0; x < num; x++){
for(int y = 0; y < num; y++){
for(int z = 0; z < blocks[x][y]; z++){
pushMatrix();
translate(x * bsize - width / 2, y * bsize - height / 2, z * bsize);
box(bsize);
popMatrix();
}
}
}
blocks[int(random(num))][int(random(num))] += 1;
}