วันอังคารที่ 25 พฤศจิกายน พ.ศ. 2557

fraction

class Fraction {
  int frac;//fraction
  int sec;//section
  Fraction( int fraction, int section) {// fraction/section
    this.frac = fraction;
    this.sec = section;
  }
  Fraction( int fraction) {// fraction/1
    this.frac = fraction;
    this.sec = 0;
  }
  void display() {
    println( this.frac + "/" + this.sec);
  }

   void plus (Fraction b) {
     int frac;
     int sec;
    if (this.sec == b.sec) {
      frac = this.frac + b.frac;
      sec = this.sec;
    } else {
      top = (this.frac * b.sec) + (b.frac * this.sec);
      sec = this.sec * b.sec;
    }
  }

  void minus(Fraction b) {
    int frac;
    int sec;
    if (this.sec == b.sec) {
      frac = this.frac - b.frac)
      sec = this.sec ;
    } else {
      frac = (this.frac * b.sec) - (b.frac * this.sec);
      sec = this.sec * b.sec;
    }
  }

  void multiply(Fraction b) {
    int frac;
    int sec;
    top = this.frac * b.frac
    sec = this.sec * b.sec
  }

  void divide(Fraction b) {
    println(this.frac * b.sec+ "/" + this.sec * b.frac);
  }
}


void setup() {

  Fraction a; // Create object
  Fraction b;

  a = new Fraction(1, 2); // 1/2
  b = new Fraction(2, 3);
  a.plus(b); // a + b
  a.minus(b); // a - b
  a.multiply(b); // a * b
  a.divide(b); // a / b
}

Lab.5 Class employee

class Employee {
  String name;
  int age;
  String position;
  float salary;
  String address;
  Employee(String name) {
    this.name = name;
  }
  void age(int Age) {
    this.age =  Age;
  }
  void position(String Position) {
    this.position = Position;
  }
  void salary(float Salary) {
    this.salary = Salary;
  }
  void address(String Address) {
    this.address = Address;
  }
  void printEmp_data() {
    println("Name     : " + this.name );
    println("Age      : " + this.age );
    println("Position : " + this.position);
    println("Address  : " + this.address);
    println("Salary   : " + this.salary + " Baht");
  }
 
}

void setup() {

  Employee number1 = new Employee ("B");
  number1.age(25);
  number1.position("Engineer");
  number1.address("");
  number1.salary(20000);
  number1.printEmp_data();
}

Lab.5 Class balloon

int R ;
int G ;
int B ;
class Balloon {
  float x;
  float y;
  int r_x;
  int r_y;
  float moveX;
  float moveY;

  Balloon(float x, float y, int r_x, int r_y, float moveX, float moveY) {
    this.x = x;
    this.y = y;
    this.r_x = r_x;
    this.r_y = r_y;
    this.moveX = moveX;
    this.moveY = moveY;
  }
  void display () {
    ellipse(this.x, this.y, this.r_x, this.r_y);
    triangle(this.x - (this.r_x/5), this.y + (2*(this.r_y/3)), this.x, this.y + (this.r_y/2), this.x + (this.r_x/5), this.y + (2*(this.r_y/3)));
    line(this.x, this.y + (this.r_y/2), this.x, this.y + 1.5*this.r_y);
 
}
  void move () {
    this.y = this.y - this.moveY;
    //this.x = this.x + this.moveX;
  }
}
Balloon []a = new Balloon[3];
void setup () {
  size(400, 300);
  a[0] = new Balloon(100, 250, 50, 70, 0.5, 1);
  a[1] = new Balloon(150, 300, 40, 60, -0.5, 1);
  a[2] = new Balloon(200, 200, 60, 80, 1, 2);
}
void draw () {
  background(255);
  for (Balloon i : a) {
    i.display();
    i.move();
  }
}

Lab.5 Class complex

class Complex {
  int a;
  int b;
  Complex(int a, int b) {
    this.a= a;
    this.b= b;
  }
  Complex(int a) {
    this.a= a;
  }
  Complex add(Complex d) {
    int r; // result
    int i;
    r= this.a+d.a;
    i= this.b+d.b ;
    Complex z= new Complex(r, i);
    return z;
  }
  Complex reduce(Complex d) {
    int r;
    int i;
    r= this.a-d.a;
    i=this.b-d.b;
    Complex z=new Complex(r, i);
    return z;
  }
  String toString() {
    String s;
    if (this.b == 0) {
      s = this.a + "";
    } else if (this.b > 0) {
      s = this.a + "+" + this.b +"i";
    } else {
      s = this.a + "" + this.b +"i";
    }
    return s;
  }
}

void setup() {
  Complex z, y, x, w, v;
  z=new Complex(5, 3);
  y=new Complex(7);
  w=new Complex(6, 7);
  x=z.add(y);
  println(x);
  v=x.reduce(w);
  println(v);
}

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

class stu

void setup(){
 int [][]hours_in={{1,2,5,3,4,2,5},
                             {2,3,4,5,1,2,5},
                             {1,5,3,2,4,5,4},
                             {3,2,1,3,5,4,5},
                             {5,1,2,4,6,4,5}};
  for(int i=0;i<hours_in.length;i++){
   println("People " +(i+1)+ " use the internet "+sum_hrs(hours_in[i])+" hours per week");
   println("  approximately average = "+round(avg_hrs_approximately(hours_in[i]))+" hours per day");
   }
}
int sum_hrs(int []a){
  int sum=0;
  for(int i = 0; i < a.length; i++){
    sum=sum+a[i];
  }
  return sum;
}
float avg_hrs_approximately(int []b){
  float average=0;
  for(int j = 0; j < b.length; j++){
    average=average+b[j];
  }
    average=average/b.length;
    return average;
}

hours of internet use

void setup(){
 int [][]hours_in={{1,2,5,3,4,2,5},
                            {2,3,4,5,1,2,5},
                            {1,5,3,2,4,5,4},
                            {3,2,1,3,5,4,5},
                            {5,1,2,4,6,4,5}};
  for(int i=0;i<hours_in.length;i++){
   println("People " +(i+1)+ " use the internet "+sum_hrs(hours_in[i])+" hours per week");
   println("  approximately average = "+round(avg_hrs_approximately(hours_in[i]))+" hours per day");
   }
}
int sum_hrs(int []a){
  int sum=0;
  for(int i = 0; i < a.length; i++){
    sum=sum+a[i];
  }
  return sum;
}
float avg_hrs_approximately(int []b){
  float average=0;
  for(int j = 0; j < b.length; j++){
    average=average+b[j];
  }
    average=average/b.length;
    return average;
}

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);
    }
  }
}

XO table


void setup() {
  size(400, 400);
  int num = 3;//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);
      fill(255);
      rect(i*(width/num.length), j*(height/num.length), width/num.length, height/num.length);
    }
  }
}

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

Function to find the index of a value in an array

void setup() {
  int []ArrayEx = { 3, 4, 5};
  Check(3, ArrayEx,"ArrayEx");
  Check(6, ArrayEx,"ArrayEx");
}
void Check(int a, int []b, String c) {
  boolean Tof = false;
  for (int i = 0; i<b.length; i++) {
    if (b[i]==a) {
      Tof = true;
      println(a + " has index = " + i + " in " + c);
    }
  }
  if (Tof == false) {
    println(a + " is not in " + c);
  }
}


วันจันทร์ที่ 13 ตุลาคม พ.ศ. 2557

Random array

void setup() {
  int []S = new int[10];
  random_array(S,1,10);
  PrintArray(S);
}
void random_array(int []x, int Min, int Max) {
  x[0] = (int)random(Min,Max+0.9999999);
  for (int i = 1; i < (x.length); i++) {
    x[i] = (int)random(Min, Max+0.9999999);  
  } 
} 
void PrintArray(int[] a) {
  print("K = {"+a[0]);
  for (int i=1; i<(a.length); i++) {
    print(","+a[i]);
  }
  println("}");
}

วันศุกร์ที่ 26 กันยายน พ.ศ. 2557

Bug-Report

Bug 1
     - ตึกในFrameที่3ที่ตั้งอยู่กับที่ เปลี่ยนตำแหน่งทุกครั้งที่วนมาดูใหม่
Why?
     - ค่าในตัวแปล array ที่ชื่อ Locat จะลดเมื่ออยู่ในFrameที่2 (ภาพตึกเคลื่อนที่) แล้วในFrameที่3ใช้ตัวแปลLocatตัวเดียวกัน
How to fix
     - ตั้งตัวแปล array ของตึกขึ้นมาใหม่  เป็นLocat2 เพื่อใช้กำหนดค่าตำแหน่งของตึก

Bug 2
     - รถไฟในFrameสุดท้ายเมื่อวนมาอีกรอบจะเริ่มวิ่งจากจุดที่หยุดรอบที่แล้ว ไม่กลับมาเริ่มใหม่
Why?
     -รถไฟใช้ตัวแปล Tsp(Train speed) ซึ่งเป็นตัวแปล Local และมีค่าเพิ่มขึ้นจากฟังก์ชัน draw_train ที่ใช้ Tsp = Tsp + 1; ในการเพิ่มค่าของตัวแปล แต่ค่าที่เพิ่มแล้วจะไม่กลับมาเท่าเดิม
How to fix
     - กำหนดค่าให้กลับมาที่เดิมโดยตั้งค่า Tsp เป็น 0 เท่าเดิมใน void mousePressed() ทุกครั้งที่กดmouse ค่า Tsp จะกลับมาเท่าเดิม

วันพุธที่ 24 กันยายน พ.ศ. 2557

Graph Aray


Graph Aray

void setup(){
    size(400,300);
    
}
int[]x = {70,120,170,220,270};
int[]y = {120,90,150,100,170};
float total = 0;

void draw(){
    background(142,226,255);
    strokeWeight(5);
    line(30,30,30,252);
    line(30,252,350,252);
    strokeWeight(1);
    draw_graph();
    fill(0);
    text('0',20,270);
    stroke(255,0,0);
    strokeWeight(2);
    line(250,280,270,280);
    text("Average line",280,280);
    average();
    text("average ",320,50);
    text("is",340,70);
    text(total,310,90);
    stroke(0);
    fill(255,0,0);
    rect(50,270,10,10);
    text("Max",70,280);
    fill(0,0,255);
    rect(150,270,10,10);
    text("Min",170,280);
}
void draw_graph(){
  for(int i = 0; i<x.length; i++){
     fill(0);
     text(y[i],x[i],height-(y[i]+60));
     textSize(15);
     if(mousePressed && (mouseButton == LEFT) && mouseX>x[i] && mouseX<x[i]+20){
            y[i] = 250-mouseY ;
     }
     if(y[i]==max(y)){
       fill(255,0,0);
       text(y[i],x[i],height-(y[i]+60));
     }
     else if(y[i]==min(y)){
     fill(0,0,255);
     text(y[i],x[i],height-(y[i]+60));
     }
     else{fill(200);}
     rect(x[i],250,20,-y[i]);
     
  }
}
void average(){
  for(int j = 0; j < y.length; j++){
  total = total +y[j] ;
  }
  total = total/5;
  line(30,height-total,350,height-total);

}

วันพุธที่ 17 กันยายน พ.ศ. 2557

Balloon


void setup(){
 size(400,300);
 frameRate(100);
}
float []y = {200,170,180,190,200};
float []x = {230,300,140,50,375};
int []r = {5,10,20,15,25};
float []R = {255,255,0,100,255};
float []G = {255,0,255,255,100};
float []B = {0,255,255,100,255};
float []speed = {1.25,1.5,2,1.75,2.5};
float Red = 180 ;
float Green = 250 ;
float Blue = 200 ;
void draw(){
  background(Red,Green,Blue);
  Red = Red + 0.1 ;
  if(Red>=255){Red=180;}
  Green = Green + 0.1 ;
  if(Green>=255){Green=250;}
  Blue = Blue + 0.1;
  if(Blue>=255){Blue=200;}
  for(int i = 0; i<y.length;i++){
draw_balloon(x[i],y[i],r[i],R[i],G[i],B[i]);//yellow
  y[i]=y[i] - speed[i];
  if(y[i]<-120){
  y[i] = 350 ; 
  R[i]=random(100,255);
  G[i]=random(100,255);
  B[i]=random(100,255);
  x[i]=random(0,400);
  }
 }
}
void draw_balloon(float x,float y,int r,float R,float G,float B){
    fill(R,G,B);
    ellipse(x,y,2*r+50,2*r+60);
    line(x,y+r+30,x,y+r+100);
    triangle(x-5,y+r+35,x,y+r+30,x+5,y+r+35);
    }




วันอังคารที่ 9 กันยายน พ.ศ. 2557

Quadrant


void setup(){
 size(500,500);
}
  void draw(){
 
  noStroke();
  textSize(25);
  fill(255,0,0);
  rect(0,0,250,250);
  fill(0,255,0);
  rect(250,0,250,250);
  fill(0,0,255);
  rect(0,250,250,250);
  fill(0);
  rect(250,250,250,250);
  fill(255,0,0);
  stroke(0);
  strokeWeight(5);
  line(0,250,500,250);
  line(250,0,250,500);
  if(mouseX>=250&&mouseX<=500&&mouseY>=0&&mouseY<=250){
    text(" Quadrant I ",300,130);
  } 
  fill(0,255,0);
  if(mouseX>=0&&mouseX<=250&&mouseY>=0&&mouseY<=250){
    text(" Quadrant II ",50,130);
  }
  fill(255,255,0);
  if(mouseX>=0&&mouseX<=250&&mouseY>=250&&mouseY<=500){
    text(" Quadrant III ",50,380);
  }
  fill(255);
  if(mouseX>=250&&mouseX<=500&&mouseY>=250&&mouseY<=500){
    text(" Quadrant IV ",300,380);
  }
} 

Bicycle


void setup(){
    size(400,300);
    background(123);
    draw_bicycle(10);
    }
    
void draw_bicycle(int move_left){
    strokeWeight(8);
    ellipse(100-move_left,220,100,100);
    ellipse(300-move_left,220,100,100);
    line(225-move_left,230,195-move_left,250);
    line(190-move_left,250,200-move_left,250);
    strokeWeight(10);
    line(100-move_left,220,135-move_left,115);
    line(135-move_left,130,260-move_left,150);
    line(260-move_left,150,300-move_left,220);
    line(225-move_left,230,300-move_left,220);
    line(225-move_left,230,130-move_left,145);
    line(225-move_left,230,268-move_left,120);
    line(135-move_left,115,100-move_left,105);
    
    fill(0);
    ellipse(260-move_left,120,50,15);
    strokeWeight(15);
    point(100-move_left,105);
    point(135-move_left,115);
    point(100-move_left,220);
    point(300-move_left,220);
    ellipse(225-move_left,230,30,30);
    strokeWeight(2);
    line(225-move_left,210,300-move_left,215);
    line(225-move_left,250,300-move_left,225);
}

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

L.2 Football-field


void setup() 
{
    size (500,660);
    background (0);
    draw_football_fill(150,20,40,20);
    draw_football_fill(200,70,40,340);

}
void draw_football_fill(int filed_color_green,int filed_color_blue,int filed_width,filed_length){    
    stroke(255);
    strokeWeight(4);
    fill(0, filed_color_green, filed_color_blue);//filed color
    rect(13+filed_width,14+filed_length,400,270);//field
    line(215+filed_width, 280+filed_length, 215+filed_width, 15+filed_length);//half-way line
    
    strokeWeight(3);
    rect(13+filed_width,75+filed_length,70,150);//penalty area left
    rect(343+filed_width,75+filed_length,70,150);//penalty area right
    
    rect(13+filed_width,107+filed_length,30,90);//goal
    rect(383+filed_width,107+filed_length,30,90);//goal
    
    int center_radius=70;
    ellipse(215+filed_width,150+filed_length,center_radius,center_radius);
    //centre circle
        
    arc(342+filed_width,152+filed_length,50,50, PI/2,TWO_PI-PI/2);
    arc(85+filed_width,152+filed_length,50,50, -PI/2,PI/2);
    arc(16+filed_width, 16+filed_length, 20, 20, 0, PI/2);
    arc(410+filed_width, 16+filed_length, 20, 20, PI/2, PI);
    arc(410+filed_width, 281+filed_length, 20, 20, PI, TWO_PI-PI/2);
    arc(16+filed_width, 281+filed_length, 20, 20, TWO_PI-PI/2, TWO_PI);
    fill(255);
    ellipse(62+filed_width, 151+filed_length, 5, 5);
    ellipse(362+filed_width, 151+filed_length, 5, 5);
    ellipse(215+filed_width, 151+filed_length, 5, 5);//centre spot
        
    }

L.2 spoon and fork


void setup() {
  size(400, 300);
  background(60,120,60);
  stroke(196);
  fill(196);  
  void draw_spoon(-80,-30);//1
  void draw_fork(-80,-30);//1
  void draw_spoon(20,-30);//2
  void draw_fork(20,-30);//2
  void draw_spoon(120,-30);//3
  void draw_fork(120,-30);//3
  void draw_spoon(220,-30);//4
  void draw_fork(220,-30);//4
  void draw_spoon(220,100);//5
  void draw_fork(220,100);//5
  void draw_spoon(120,100);//6
  void draw_fork(120,100);//6
  void draw_spoon(20,100);//7
  void draw_fork(20,100);//7
  void draw_spoon(-80,100);//8
  void draw_fork(-80,100);//8
  }
  void draw_spoon(int move_x, int move_y){ 
  rect(115+move_x, 70+move_y, 6, 80,10);  
  ellipse(118+move_x, 70+move_y, 30, 40);
  }
  void draw_fork(int move_x, int move_y){
  rect(155+move_x, 50+move_y, 2, 35,10); 
  rect(150+move_x, 50+move_y, 2, 35,10); 
  rect(165+move_x, 50+move_y, 2, 35,10);  
  rect(160+move_x, 50+move_y, 2, 35,10);  
  rect(156+move_x, 80+move_y, 6, 70,10);  
  rect(150+move_x, 80+move_y, 17, 6,10);  
}

L.2 Star


void setup() {
  size(400, 300);
  int background_color_red=10,
      background_color_green=50,
      background_color_blue=100;
  background(background_color_red, background_color_green, background_color_blue);
  darw_star(0,-20,100,100);
  darw_star(50,50,150,150);
  darw_star(100,120,200,200);
  darw_star(150,190,255,255);
  darw_star(200,120,200,200);
  darw_star(250,50,150,150);
  darw_star(300,-20,100,100);
  }
  void darw_star(int location_x, int location_y, int color_red, int color_green)
  {
  noStroke();
  fill(color_red, color_green, 0);
  
  beginShape();
  vertex(47+location_x, 0+location_y);
  vertex(61+location_x, 30+location_y);
  vertex(94+location_x, 35+location_y);
  vertex(70+location_x, 57+location_y);
  vertex(76+location_x, 90+location_y);
  vertex(47+location_x, 75+location_y);
  vertex(18+location_x, 90+location_y);
  vertex(24+location_x, 57+location_y);
  vertex(0+location_x, 35+location_y);
  vertex(33+location_x, 30+location_y);
  endShape(CLOSE);
}

วันพุธที่ 3 กันยายน พ.ศ. 2557

L.2 Turtle


void setup() {
  size(400, 300);
  background(60, 237, 221);

  frameRate(20);
}

int walk_right = 70;
int walk_front = -100;

void draw()  
{
  background(60, 237, 221);
  draw_turtle(walk_right,walk_front );
  draw_turtle(-walk_right,walk_front );
  draw_turtle(0,walk_front );
   walk_right = walk_right + 1;
   if (walk_right > 200) {walk_right = 70;}
   walk_front = walk_front + 3;
   if (walk_front > 290) {walk_front = -100;}
  
  
 
}
void draw_turtle(int walk_right, int walk_front)
{
  fill(173, 255, 47);
  ellipse(165+walk_right, 220-walk_front, 30, 15);
  ellipse(165+walk_right, 260-walk_front, 30, 15);
  ellipse(235+walk_right, 220-walk_front, 30, 15);
  ellipse(235+walk_right, 260-walk_front, 30, 15);
  ellipse(200+walk_right, 285-walk_front, 10, 20);
  ellipse(200+walk_right, 185-walk_front, 40, 40);
  fill(85, 107, 47);
  ellipse(200+walk_right, 240-walk_front, 70, 90);
  line(200+walk_right, 205-walk_front, 200+walk_right, 275-walk_front);
  quad(180+walk_right, 210-walk_front, 196+walk_right, 205-walk_front, 196+walk_right, 220-walk_front, 185+walk_right, 220-walk_front);
  quad(180+walk_right, 230-walk_front, 196+walk_right, 235-walk_front, 196+walk_right, 220-walk_front, 185+walk_right, 220-walk_front);
  quad(180+walk_right, 240-walk_front, 196+walk_right, 235-walk_front, 196+walk_right, 250-walk_front, 185+walk_right, 250-walk_front);
  quad(180+walk_right, 260-walk_front, 196+walk_right, 265-walk_front, 196+walk_right, 250-walk_front, 185+walk_right, 250-walk_front);
  quad(180+walk_right, 275-walk_front, 196+walk_right, 280-walk_front, 196+walk_right, 265-walk_front, 185+walk_right, 265-walk_front);
  quad(220+walk_right, 210-walk_front, 204+walk_right, 205-walk_front, 204+walk_right, 220-walk_front, 215+walk_right, 220-walk_front);
  quad(220+walk_right, 230-walk_front, 204+walk_right, 235-walk_front, 204+walk_right, 220-walk_front, 215+walk_right, 220-walk_front);
  quad(220+walk_right, 240-walk_front, 204+walk_right, 235-walk_front, 204+walk_right, 250-walk_front, 215+walk_right, 250-walk_front);
  quad(220+walk_right, 260-walk_front, 204+walk_right, 265-walk_front, 204+walk_right, 250-walk_front, 215+walk_right, 250-walk_front);
  quad(220+walk_right, 275-walk_front, 204+walk_right, 280-walk_front, 204+walk_right, 265-walk_front, 215+walk_right, 265-walk_front);
  ellipse(185+walk_right, 179-walk_front, 10, 10);
  ellipse(215+walk_right, 179-walk_front, 10, 10);
} 

วันอังคารที่ 2 กันยายน พ.ศ. 2557

L.2 Subject


void setup() 
{
  size(400, 300);
  background(0);
  frameRate(30);
 
draw_mercury(10);
draw_venus(10);
draw_earth(10);
draw_mars(10);
draw_jupiter(10);
draw_saturn(10);
noStroke();
draw_uranus(10);
draw_neptune(10);
draw_sun(200,150,0);
}
void draw_sun(int sun_color_red,int sun_color_green,int sun_color_blue) 
{   
  fill(sun_color_red, sun_color_green, sun_color_blue);//sun color
  ellipse(-210, 150, 600, 600);//sun
}
void draw_mercury(int move_mercury_X)  
{
  fill(250,250,0);//mercury color
  ellipse(120+move_mercury_X, 150, 10, 10);//mercury
} 
void draw_venus(int move_venus_X)
{
  fill(179,150,0);//venus color
  ellipse(175+move_venus_X, 150, 30, 30);//venus
}
void draw_earth(int move_earth_X)
{
  fill(0,118,174);//earth color
  ellipse(240+move_earth_X, 150, 35, 35);//earth 
} 
void draw_mars(int move_mars_X)
{
  fill(94,47,0);//mars color
  ellipse(300+move_mars_X, 150, 25, 25);//mars
}
void draw_jupiter(int move_jupiter_X)
{
  fill(160,115,90);//jupiter color
  ellipse(390+move_jupiter_X, 150, 120, 120);//jupiter
}
void draw_saturn(int move_saturn_X)
{
  fill(190,140,50);//saturn color
  ellipse(550+move_saturn_X, 150, 100, 100);//saturn
  stroke(153,102,0);
  strokeWeight(10);
  line(450+move_saturn_X, 200, 650+move_saturn_X, 100);//saturn ring
}
void draw_uranus(int move_uranus_X)
{
  fill(204);//uranus color
  ellipse(680+move_uranus_X, 150, 50, 50);//uranus
}
void draw_neptune(int move_neptune_X)
{
  fill(51,102,153);//neptune color
  ellipse(770+move_neptune_X, 150, 50, 50);//neptune
}

L.2 Tree


void setup()
{
  size(323, 200);
  stroke(255);   
  draw_tree(150,0);
  draw_tree(-160,0);
  draw_tree(-60,0);
  draw_tree(50,0);
  draw_tree(-10,-10);
  draw_tree(100,-10);
  draw_tree(-110,-10);
}

void draw_tree(int location_x,int location_y)
{
  noStroke();

  fill(204, 102, 0);
  rect(155+location_x, 120+location_y, 18, 80);
  triangle(152+location_x, 215+location_y, 164+location_x, 100+location_y, 176+location_x, 215+location_y);
  triangle(152+location_x, 151+location_y, 164+location_x, 200+location_y, 176+location_x, 151+location_y);

  fill(0, 95, 0);
  ellipse(135+location_x, 65+location_y, 30, 30);
  ellipse(165+location_x, 132+location_y, 30, 30);
  ellipse(195+location_x, 65+location_y, 30, 30);
  ellipse(120+location_x, 120+location_y, 30, 30);
  ellipse(150+location_x, 130+location_y, 30, 30);
  ellipse(135+location_x, 132+location_y, 30, 30);
  ellipse(145+location_x, 138+location_y, 30, 30);
  ellipse(185+location_x, 138+location_y, 30, 30);
  ellipse(155+location_x, 136+location_y, 30, 30);
  ellipse(175+location_x, 136+location_y, 30, 30);

  fill(0, 135, 0);
  ellipse(210+location_x, 120+location_y, 30, 30);
  ellipse(150+location_x, 100+location_y, 30, 30);
  ellipse(220+location_x, 105+location_y, 30, 30);
  ellipse(150+location_x, 55+location_y, 30, 30);

  fill(0, 125, 0);
  ellipse(180+location_x, 100+location_y, 30, 30);
  ellipse(165+location_x, 110+location_y, 30, 30);
  ellipse(135+location_x, 110+location_y, 30, 30);
  ellipse(180+location_x, 55+location_y, 30, 30);
  ellipse(115+location_x, 105+location_y, 30, 30);
  ellipse(195+location_x, 132+location_y, 30, 30);

  fill(0, 145, 0);
  ellipse(195+location_x, 110+location_y, 30, 30);
  ellipse(165+location_x, 85+location_y, 30, 30);
  ellipse(135+location_x, 75+location_y, 30, 30);
  ellipse(165+location_x, 50+location_y, 30, 30);

  fill(0, 155, 0);
  ellipse(195+location_x, 75+location_y, 30, 30);
  ellipse(120+location_x, 85+location_y, 30, 30);
  ellipse(210+location_x, 85+location_y, 30, 30);
  ellipse(155+location_x, 70+location_y, 30, 30);
  ellipse(180+location_x, 130+location_y, 30, 30);

  fill(0, 165, 0);
  ellipse(175+location_x, 70+location_y, 30, 30);
  ellipse(165+location_x, 65+location_y, 30, 30);
  ellipse(135+location_x, 85+location_y, 30, 30);
  ellipse(195+location_x, 85+location_y, 30, 30);

}

วันจันทร์ที่ 1 กันยายน พ.ศ. 2557

L.? Subject


void setup() 
{
  size(400, 300);
  frameRate(30);

}
float sun_color_red = 200;
float sun_color_green = 150;
float sun_color_blue = 0;

float move_mercury_X = 0;
float move_venus_X = 0;
float move_earth_X =0;
float move_mars_X = 0;
float move_jupiter_X = 0;
float move_saturn_X = 0;
float move_uranus_X = 0;
float move_neptune_X = 0;


void draw() 
{   
  sun_color_red = sun_color_red + 1;
  if (sun_color_red > 255) {sun_color_red = 200; }
  sun_color_green = sun_color_green + 1;
  if (sun_color_green > 205) {sun_color_green = 150; }
  sun_color_blue = sun_color_blue +10;
  if (sun_color_blue < 20) {sun_color_blue = 0; }
  move_mercury_X = move_mercury_X - 0.2;
  if (move_mercury_X < -120) {move_mercury_X = 0;}
  move_venus_X = move_venus_X - 0.35;
  if (move_venus_X < -210) {move_venus_X = 0;}
  move_earth_X = move_earth_X - 0.54;
  if (move_earth_X < -324) {move_earth_X = 0;}
  move_mars_X = move_mars_X - 0.7;
  if (move_mars_X < -420) {move_mars_X = 0;}
  move_jupiter_X = move_jupiter_X - 0.95;
  if (move_jupiter_X < -570) {move_jupiter_X = 0;}
  move_saturn_X = move_saturn_X - 1.3;
  if (move_saturn_X < -780) {move_saturn_X = 0;}
  move_uranus_X = move_uranus_X -1.6;
  if (move_uranus_X < -960) {move_uranus_X = 0;}
  move_neptune_X = move_neptune_X -1.8;
  if (move_neptune_X < -1080) {move_neptune_X = 0;}
  background(0);
  fill(51,102,153);//neptune color
  ellipse(770+move_neptune_X, 150, 50, 50);//neptune
  
  fill(204);//uranus color
  ellipse(680+move_uranus_X, 150, 50, 50);//uranus
  
  fill(190,140,50);//saturn color
  ellipse(550+move_saturn_X, 150, 100, 100);//saturn
  stroke(153,102,0);
  strokeWeight(10);
  line(450+move_saturn_X, 200, 650+move_saturn_X, 100);//saturn ring
  
  noStroke();
  int jupiter_color_red=160,jupiter_color_green=115,jupiter_color_blue=90;
  fill(jupiter_color_red,jupiter_color_green,jupiter_color_blue);//jupiter color
  ellipse(390+move_jupiter_X, 150, 120, 120);//jupiter

  int mars_color_red=94,mars_color_green=47,mars_color_blue=0;
  fill(mars_color_red,mars_color_green,mars_color_blue);//mars color
  ellipse(300+move_mars_X, 150, 25, 25);//mars
  
  int earth_color_red=0,earth_color_green=118,earth_color_blue=174;
  fill(earth_color_red,earth_color_green,earth_color_blue);//earth color
  ellipse(240+move_earth_X, 150, 35, 35);//earth
  
  int venus_color_red=179,venus_color_green=150,venus_color_blue=0;
  fill(venus_color_red,venus_color_green,venus_color_blue);//venus color
  ellipse(175+move_venus_X, 150, 30, 30);//venus
   
  int mercury_color_red=250,mercury_color_green=250,mercury_color_blue=0;
  fill(mercury_color_red,mercury_color_green,mercury_color_blue);//mercury color
  ellipse(120+move_mercury_X, 150, 10, 10);//mercury
  
  fill(sun_color_red, sun_color_green, sun_color_blue);//sun color
  ellipse(-210, 150, 600, 600);//sun
}

L.? Pencil


void setup() 

{

  size(400, 300); 
       
  frameRate(30);

}

float x = -50;
float y = 50;

void draw() 

{ 

  background(0); 

  x = x + 1; 
  if (x > 50) { x = -50; } 
  y = y - 1;
  if (y < -50) { y = 50; }
  size(400, 300);
  background(200);
  

  fill(0,200,0);
  quad(185+x, 90+y, 215+x, 100+y, 190+x, 190+y, 160+x, 180+y);
  fill(255,190,141);
  triangle(160+x,180+y,167+x,210+y,190+x,190+y);
  fill(0);
  triangle(163+x,195+y,167+x,210+y,179+x,200+y);
  arc(203.5+x, 85+y, 31, 31, TWO_PI-PI/1.1, TWO_PI+PI/9);
  fill(100);
  quad(188+x, 80+y, 218+x, 90+y, 215+x, 100+y, 185+x, 90+y);
  fill(200,0,0);
  quad(185+x, 90+y, 195+x, 94+y, 170+x, 184+y, 160+x, 180+y);
  fill(0,0,200);
  quad(205+x, 97+y, 215+x, 100+y, 190+x, 190+y, 180+x, 187+y);
  strokeWeight(2);
  line(167+x,210+y,117,260);
}

L.2 Pencil


void setup() {
  size(400, 300);
  background(255);
  draw_pencil(100,50);
  }
  void draw_pencil(int move_pencil_x,int move_pencil_y)
  {
  fill(0,200,0);
  quad(185+move_pencil_x, 90+move_pencil_y, 215+move_pencil_x, 100+move_pencil_y, 190+move_pencil_x, 190+move_pencil_y, 160+move_pencil_x, 180+move_pencil_y);
  fill(255,190,141);
  triangle(160+move_pencil_x,180+move_pencil_y,167+move_pencil_x,210+move_pencil_y,190+move_pencil_x,190+move_pencil_y);
  fill(0);
  triangle(163+move_pencil_x,195+move_pencil_y,167+move_pencil_x,210+move_pencil_y,179+move_pencil_x,200+move_pencil_y);
  arc(203.5+move_pencil_x, 85+move_pencil_y, 31, 31, TWO_PI-PI/1.1, TWO_PI+PI/9);
  fill(100);
  quad(188+move_pencil_x, 80+move_pencil_y, 218+move_pencil_x, 90+move_pencil_y, 215+move_pencil_x, 100+move_pencil_y, 185+move_pencil_x, 90+move_pencil_y);
  fill(200,0,0);
  quad(185+move_pencil_x, 90+move_pencil_y, 195+move_pencil_x, 94+move_pencil_y, 170+move_pencil_x, 184+move_pencil_y, 160+move_pencil_x, 180+move_pencil_y);
  fill(0,0,200);
  quad(205+move_pencil_x, 97+move_pencil_y, 215+move_pencil_x, 100+move_pencil_y, 190+move_pencil_x, 190+move_pencil_y, 180+move_pencil_x, 187+move_pencil_y);
}

วันอาทิตย์ที่ 31 สิงหาคม พ.ศ. 2557

L.? tree


int locationtree_x = 150;
int locationtree_y = 0;
float locationleaf_x = 150;
float update = 0.1;
void setup()
{
  size(323, 200);
  stroke(255);
  frameRate(30);
}  

void draw() {
  background(255);
  draw_tree(locationtree_x, locationtree_y, locationleaf_x);
  draw_tree(locationtree_x-310, locationtree_y, locationleaf_x-310);
  draw_tree(locationtree_x-210, locationtree_y, locationleaf_x-210);
  draw_tree(locationtree_x-100, locationtree_y, locationleaf_x-100);
  draw_tree(locationtree_x-160, locationtree_y-10, locationleaf_x-160);
  draw_tree(locationtree_x-50, locationtree_y-10, locationleaf_x-50);
  draw_tree(locationtree_x-260, locationtree_y-10, locationleaf_x-260);
  locationleaf_x = locationleaf_x - update;
  if (locationleaf_x < 148 || locationleaf_x > 150) { 
    update = update*-1 ;
  }
}

void draw_tree(int locationtree_x, int locationtree_y, float locationleaf_x)
{
  noStroke();

  fill(204, 102, 0);
  rect(155+locationtree_x, 120+locationtree_y, 18, 80);
  triangle(152+locationtree_x, 215+locationtree_y, 164+locationtree_x, 100+locationtree_y, 176+locationtree_x, 215+locationtree_y);
  triangle(152+locationtree_x, 151+locationtree_y, 164+locationtree_x, 200+locationtree_y, 176+locationtree_x, 151+locationtree_y);
  leaf(locationleaf_x, locationtree_y);
}
void leaf(float locationleaf_x, int locationleaf_y) {
  fill(0, 95, 0);
  ellipse(135+locationleaf_x, 65+locationleaf_y, 30, 30);
  ellipse(165+locationleaf_x, 132+locationleaf_y, 30, 30);
  ellipse(195+locationleaf_x, 65+locationleaf_y, 30, 30);
  ellipse(120+locationleaf_x, 120+locationleaf_y, 30, 30);
  ellipse(150+locationleaf_x, 130+locationleaf_y, 30, 30);
  ellipse(135+locationleaf_x, 132+locationleaf_y, 30, 30);
  ellipse(145+locationleaf_x, 138+locationleaf_y, 30, 30);
  ellipse(185+locationleaf_x, 138+locationleaf_y, 30, 30);
  ellipse(155+locationleaf_x, 136+locationleaf_y, 30, 30);
  ellipse(175+locationleaf_x, 136+locationleaf_y, 30, 30);

  fill(0, 135, 0);
  ellipse(210+locationleaf_x, 120+locationleaf_y, 30, 30);
  ellipse(150+locationleaf_x, 100+locationleaf_y, 30, 30);
  ellipse(220+locationleaf_x, 105+locationleaf_y, 30, 30);
  ellipse(150+locationleaf_x, 55+locationleaf_y, 30, 30);

  fill(0, 125, 0);
  ellipse(180+locationleaf_x, 100+locationleaf_y, 30, 30);
  ellipse(165+locationleaf_x, 110+locationleaf_y, 30, 30);
  ellipse(135+locationleaf_x, 110+locationleaf_y, 30, 30);
  ellipse(180+locationleaf_x, 55+locationleaf_y, 30, 30);
  ellipse(115+locationleaf_x, 105+locationleaf_y, 30, 30);
  ellipse(195+locationleaf_x, 132+locationleaf_y, 30, 30);

  fill(0, 145, 0);
  ellipse(195+locationleaf_x, 110+locationleaf_y, 30, 30);
  ellipse(165+locationleaf_x, 85+locationleaf_y, 30, 30);
  ellipse(135+locationleaf_x, 75+locationleaf_y, 30, 30);
  ellipse(165+locationleaf_x, 50+locationleaf_y, 30, 30);

  fill(0, 155, 0);
  ellipse(195+locationleaf_x, 75+locationleaf_y, 30, 30);
  ellipse(120+locationleaf_x, 85+locationleaf_y, 30, 30);
  ellipse(210+locationleaf_x, 85+locationleaf_y, 30, 30);
  ellipse(155+locationleaf_x, 70+locationleaf_y, 30, 30);
  ellipse(180+locationleaf_x, 130+locationleaf_y, 30, 30);

  fill(0, 165, 0);
  ellipse(175+locationleaf_x, 70+locationleaf_y, 30, 30);
  ellipse(165+locationleaf_x, 65+locationleaf_y, 30, 30);
  ellipse(135+locationleaf_x, 85+locationleaf_y, 30, 30);
  ellipse(195+locationleaf_x, 85+locationleaf_y, 30, 30);
}

วันพุธที่ 27 สิงหาคม พ.ศ. 2557

spoon and fork


void setup() {
  size(300, 200);
  background(60,120,60);
  
  int move_x = 10;  
  int move_y = 20;
  stroke(196);  
  fill(196);  
  rect(76+move_x, 70+move_y, 6, 80,7);  
  ellipse(80+move_x, 70+move_y, 30, 40);
  
  rect(155+move_x, 50+move_y, 2, 34,11); 
  rect(150+move_x, 50+move_y, 2, 34,11); 
  rect(165+move_x, 50+move_y, 2, 34,11);  
  rect(160+move_x, 50+move_y, 2, 34,11);  
  rect(156+move_x, 80+move_y, 6, 70,11);  
  rect(150+move_x, 80+move_y, 17, 6,7);  


}

L.1 Dream


void setup() {
  size(400, 300);
  background(20,100,200);
  fill(200);
  int move_x=20;
  rect(100+move_x,200,200,200);
  rect(100+move_x,200,100,100);
  fill(102,25,0);
  triangle(200+move_x, 200, 250+move_x, 130, 300+move_x, 200);
  noStroke();
  rect(151+move_x,130,99,70);
  stroke(0);
  triangle(100+move_x, 200, 150+move_x, 130, 200+move_x, 200);
  fill(200,50,50);
  rect(130+move_x,250,40,50);
  line(150+move_x,250,150+move_x,300);
  fill(0,150,255);
  rect(250+move_x,250,20,30);
  rect(230+move_x,250,20,30);
  
}

Dream


void setup() {
  size(400, 300);
  background(20,100,200);
  fill(200);
  
  rect(100,200,200,200);
  rect(100,200,100,100);
  fill(102,25,0);
  triangle(200, 200, 250, 130, 300, 200);
  noStroke();
  rect(151,130,99,70);
  stroke(0);
  triangle(100, 200, 150, 130, 200, 200);
  fill(200,50,50);
  rect(130,250,40,50);
  line(150,250,150,300);
  fill(0,150,255);
  rect(250,250,20,30);
  rect(230,250,20,30);
  
}

L.1 Subject


void setup() {
  size(400, 300);
  background(0);
  
  int sun_color_red=250,sun_color_green=200,sun_color_blue=0;
  fill(sun_color_red, sun_color_green, sun_color_blue);//sun color
  
  int move_sun_X=x,move_sun_Y=y;//move sun
  int x=-10,y=0;
  ellipse(-200+x, 150+y, 600, 600);//sun
  
  int mercury_color_red=250,mercury_color_green=250,mercury_color_blue=0;
  fill(mercury_color_red,mercury_color_green,mercury_color_blue);//mercury color
  
  int move_mercury_X=10,move_mercury_Y=10;
  ellipse(120+move_mercury_X, 150+move_mercury_Y, 10, 10);//mercury
  
  int venus_color_red=179,venus_color_green=150,venus_color_blue=0;
  fill(venus_color_red,venus_color_green,venus_color_blue);//venus color
  
  int move_venus_X=10,move_venus_Y=10;
  ellipse(175+move_venus_X, 150+move_venus_Y, 30, 30);//venus
  
  int earth_color_red=0,earth_color_green=118,earth_color_blue=174;
  fill(earth_color_red,earth_color_green,earth_color_blue);//earth color
  
  int move_earth_X=10,move_earth_Y=10;
  ellipse(240+move_earth_X, 150+move_earth_Y, 33, 33);//earth
  
  int mars_color_red=94,mars_color_green=47,mars_color_blue=0;
  fill(mars_color_red,mars_color_green,mars_color_blue);//mars color
  
  int move_mars_X=10,move_mars_Y=10;
  ellipse(300+move_mars_X, 150+move_mars_Y, 25, 25);//mars
  
  int jupiter_color_red=255,jupiter_color_green=194,jupiter_color_blue=140;
  fill(jupiter_color_red,jupiter_color_green,jupiter_color_blue);//jupiter color
  
  int move_jupiter_X=10,move_jupiter_Y=10;
  ellipse(390+move_jupiter_X, 150+move_jupiter_Y, 120, 120);//jupiter
}

วันอังคารที่ 26 สิงหาคม พ.ศ. 2557

Subject


void setup() {
  size(400, 300);
  background(0);
  fill(250, 200, 0);//sun color
  ellipse(-200, 150, 600, 600);//sun
  fill(250, 250, 0);//mercury color
  ellipse(120, 150, 10, 10);//mercury
  fill(179, 116, 0);//venus color
  ellipse(175, 150, 30, 30);//venus
  fill(0, 118, 174);//earthcolor
  ellipse(240, 150, 33, 33);//earth
  fill(94, 47, 0);//mars color
  ellipse(300, 150, 25, 25);//mars
  fill(255, 194, 140);//jupiter color
  ellipse(390, 150, 120, 120);//jupiter
}

Star


void setup() {
  size(400, 300);
  int background_color_red=10,
      background_color_green=50,
      background_color_blue=100;
  background(background_color_red, background_color_green, background_color_blue);
  int location_X=x, location_Y=y;
  int x=50, y=50;
  int color_red=200, color_green=200, color_blue=0;
  strokeWeight(2);
  stroke(color_red, color_green, color_blue);
  fill(200, 200, 0);
  beginShape();
  vertex(47+x, 0+y);
  vertex(61+x, 30+y);
  vertex(94+x, 35+y);
  vertex(70+x, 57+y);
  vertex(76+x, 90+y);
  vertex(47+x, 75+y);
  vertex(18+x, 90+y);
  vertex(24+x, 57+y);
  vertex(0+x, 35+y);
  vertex(33+x, 30+y);
  endShape(CLOSE);
}

Football field


void setup() 
{
    size (430,300);
    background (0);
    
    stroke(255);
    strokeWeight(4);
    int filed_color_red=0;
    int filed_color_green=150;
    int filed_color_blue=20;
    fill(filed_color_red, filed_color_green, filed_color_blue);//filed color
    
    int filed_width=x, filed_length=y;
    int x=5,y=5;
    
    rect(13+x,14+y,400,270);//field
    
    strokeWeight(4);//
    line(215+x, 280+y, 215+x, 15+y);//half-way line
    
    strokeWeight(3);
    rect(13+x,75+y,70,150);//penalty area left
    rect(343+x,75+y,70,150);//penalty area right
    
    rect(13+x,107+y,30,90);//goal
    rect(383+x,107+y,30,90);//goal
    
    int center_radius=70;
        
    ellipse(215+x,150+y,center_radius,center_radius);//centre circle
        
    arc(342+x,152+y,50,50, PI/2,TWO_PI-PI/2);
    arc(85+x,152+y,50,50, -PI/2,PI/2);
    arc(16+x, 16+y, 20, 20, 0, PI/2);
    arc(410+x, 16+y, 20, 20, PI/2, PI);
    arc(410+x, 281+y, 20, 20, PI, TWO_PI-PI/2);
    arc(16+x, 281+y, 20, 20, TWO_PI-PI/2, TWO_PI);
    fill(255);
    ellipse(62+x, 151+y, 5, 5);
    ellipse(362+x, 151+y, 5, 5);
    ellipse(215+x, 151+y, 5, 5);//centre spot
        
    }

วันพุธที่ 20 สิงหาคม พ.ศ. 2557

L.1 tree


void setup() {
  size(323, 200);
  background(207, 231, 245);
  
  int x=20;
  int y=-15;
  noStroke();
  fill(204, 102, 0);
  rect(155+x, 120, 18, 80)
  triangle(152+x, 215+y, 164+x, 100+y, 176+x, 215+y)
  triangle(152+x, 151+y, 164+x, 200+y, 176+x, 151+y)
  fill(0, 95, 0);
  ellipse(135+x, 65+y, 30, 30)
  ellipse(165+x, 132+y, 30, 30)
  ellipse(195+x, 65+y, 30, 30)
  ellipse(120+x, 120+y, 30, 30)
  ellipse(150+x, 130+y, 30, 30)
  ellipse(135+x, 132+y, 30, 30)
  ellipse(145+x, 138+y, 30, 30)
  ellipse(185+x, 138+y, 30, 30)
  ellipse(155+x, 136+y, 30, 30)
  ellipse(175+x, 136+y, 30, 30)
  fill(0, 135, 0);
  ellipse(210+x, 120+y, 30, 30)
  ellipse(150+x, 100+y, 30, 30)
  ellipse(220+x, 105+y, 30, 30)
  ellipse(150+x, 55+y, 30, 30)
  fill(0, 125, 0);
  ellipse(180+x, 100+y, 30, 30)
  ellipse(165+x, 110+y, 30, 30)
  ellipse(135+x, 110+y, 30, 30)
  ellipse(180+x, 55+y, 30, 30)
  ellipse(115+x, 105+y, 30, 30)
  ellipse(195+x, 132+y, 30, 30)
  fill(0, 145, 0);
  ellipse(195+x, 110+y, 30, 30)
  ellipse(165+x, 85+y, 30, 30)
  ellipse(135+x, 75+y, 30, 30)
  ellipse(165+x, 50+y, 30, 30)
  fill(0, 155, 0);
  ellipse(195+x, 75+y, 30, 30)
  ellipse(120+x, 85+y, 30, 30)
  ellipse(210+x, 85+y, 30, 30)
  ellipse(155+x, 70+y, 30, 30)
  ellipse(180+x, 130+y, 30, 30)
  fill(0, 165, 0);
  ellipse(175+x, 70+y, 30, 30)
  ellipse(165+x, 65+y, 30, 30)
  ellipse(135+x, 85+y, 30, 30)
  ellipse(195+x, 85+y, 30, 30)
  }

วันพุธที่ 13 สิงหาคม พ.ศ. 2557

Tree


void setup() {
  size(323, 200);
  background(207, 231, 245);
  
  noStroke();
  fill(204, 102, 0);
  rect(155, 120, 18, 80);
  triangle(152, 200, 164, 100, 176, 200);
  triangle(152, 151, 164, 200, 176, 151);
  fill(0, 95, 0);
  ellipse(135, 65, 30, 30);
  ellipse(165, 132, 30, 30);
  ellipse(195, 65, 30, 30);
  ellipse(120, 120, 30, 30);
  ellipse(150, 130, 30, 30);
  ellipse(135, 132, 30, 30);
  ellipse(145, 138, 30, 30);
  ellipse(185, 138, 30, 30);
  ellipse(155, 136, 30, 30);
  ellipse(175, 136, 30, 30);
  fill(0, 135, 0);
  ellipse(210, 120, 30, 30);
  ellipse(150, 100, 30, 30);
  ellipse(220, 105, 30, 30);
  ellipse(150, 55, 30, 30);
  fill(0, 125, 0);
  ellipse(180, 100, 30, 30);
  ellipse(165, 110, 30, 30);
  ellipse(135, 110, 30, 30);
  ellipse(180, 55, 30, 30);
  ellipse(115, 105, 30, 30);
  ellipse(195, 132, 30, 30);
  fill(0, 145, 0);
  ellipse(195, 110, 30, 30);
  ellipse(165, 85, 30, 30);
  ellipse(135, 75, 30, 30);
  ellipse(165, 50, 30, 30);
  fill(0, 155, 0);
  ellipse(195, 75, 30, 30);
  ellipse(120, 85, 30, 30);
  ellipse(210, 85, 30, 30);
  ellipse(155, 70, 30, 30);
  ellipse(180, 130, 30, 30);
  fill(0, 165, 0);
  ellipse(175, 70, 30, 30);
  ellipse(165, 65, 30, 30);
  ellipse(135, 85, 30, 30);
  ellipse(195, 85, 30, 30);
  ellipse(115, 105, 30, 30);
  ellipse(195, 132, 30, 30);
  fill(0, 145, 0);
  ellipse(195, 110, 30, 30);
  ellipse(165, 85, 30, 30);
  ellipse(135, 75, 30, 30);
  ellipse(165, 50, 30, 30);
  fill(0, 155, 0);
  ellipse(195, 75, 30, 30);
  ellipse(120, 85, 30, 30);
  ellipse(210, 85, 30, 30);
  ellipse(155, 70, 30, 30);
  ellipse(180, 130, 30, 30);
  fill(0, 165, 0);
  ellipse(175, 70, 30, 30);
  ellipse(165, 65, 30, 30);
  ellipse(135, 85, 30, 30);
  ellipse(195, 85, 30, 30);
  }