E
void setup(){
size (500,500);
int x=50;
int y=30;
int r=60;
int[] posts=new int[5];
posts[0]=5;
posts[1]=4;
posts[2]=2;
posts[3]=3;
posts[4]=3;
posts[5]=2;
posts[6]=4;
posts[7]=5;
drawRow(x,y,posts[0],r);
y=y+r;
drawRow(x,y,posts[1],r);
y=y+r;
drawRow(x,y,posts[2],r);
y=y+r;
drawRow(x,y,posts[3],r);
y=y+r;
drawRow(x,y,posts[4],r);
y=y+r;
drawRow(x,y,posts[5],r);
y=y+r;
drawRow(x,y,posts[6],r);
y=y+r;
drawRow(x,y,posts[7],r);
y=y+r;
}
void drawRow(int x,int y,int n,int r){
while(n>0){
ellipse(x,y,r,r);
n=n-1;
x=x+60;
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น