void setup()
{
size(600, 600);
background(255);
strokeWeight(8);
stroke(0);
int i, j ,xPos ,yPos;
int xLine, yLine;
int[][] Pieces=new int[3][3];
for (xLine=200,yLine=200 ; xLine<=400 && yLine<=400 ; xLine+=200,yLine+=200)
{
line(xLine, 0, xLine, height);
line(0, yLine, width, yLine);
}
for (i=0,xPos=100;i<Pieces.length;i++,xPos+=200)
{
for (j=0,yPos=100;j<Pieces.length;j++,yPos+=200)
{
Pieces[i][j]=int(random(0,2));
if (Pieces[i][j]%2==0)
{DrawO(xPos, yPos);}
else DrawX(xPos, yPos);
}
}
}
void DrawO(int x, int y)
{
int r=180;
strokeWeight(1);
stroke(0);
fill(0);
ellipse(x, y, r, r);
fill(255);
ellipse(x, y, r-15, r-15);
}
void DrawX(int x, int y)
{
strokeWeight(8);
line(x-90, y-90, x+90, y+90);
line(x-90, y+90, x+90, y-90);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น