วันอาทิตย์ที่ 22 กันยายน พ.ศ. 2556

Othello






void setup()
{
  size(400, 400);
  int i;
  int j;
  int[][] Othello = new int[8][8] ;
  int x;
  int y;

  background(44, 132, 0);
  for (x=50 , y=50 ; x < width && y < height ; x += 50,y += 50)
  {
    line(x, 0, x, height);
    line(0, y, width, y);
  }
  noStroke();
  smooth();
  for (i = 0, x = 25 ; Othello.length > i ; i++,x += 50)
  {
    for (j=0, y=25 ; Othello[0].length > j ; j++,y+=50)
    {
      Othello[i][j]= int(random(0, 200));
      if (Othello[i][j]%2 == 0)
      {
        fill(255);
      }
      else
      {
        fill(0);
      }
      ellipse(x, y, 40, 40);
    }
  }
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น