วันอังคารที่ 28 ตุลาคม พ.ศ. 2557

Chess table


void setup() {
  size(400, 400);
  int num = 8;//number of slot in line
  int [][]keep_XO_Table = new int[num][num];
  draw_G(keep_XO_Table[num-1]);
}
void draw_G(int []num) {
  for (int i = 0; i < num.length; i++) {
    for (int j = 0; j < num.length; j++) {
      stroke(0);
      if(i%2==0){
          if(j%2==0){
              fill(255);
          }else{fill(100);}
      }else if(i%2!=0){
          if(j%2==0){
              fill(100);
          }else{fill(255);}
      }
      rect(i*(width/num.length), j*(height/num.length), width/num.length, height/num.length);
    }
  }
}

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

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