submission by jtoy for tetris (View the other submissions)
function Shape(){
  this.x=random(width)
  this.y= random(height)
  this.speed = random(1,3)
  this.size = random(1,3)
  this.c = color(random(255),random(255),random(255))
  this.move = function(){
    this.y += this.speed
   if(this.y > height){
     this.y=-100
     this.x=random(width)
   }
  }
}
function Square(){
 Shape.call(this)
  this.show = function(){
    fill(this.c)
    rect(this.x,this.y,40*this.size,40*this.size)
  }
}

function Line(){
   Shape.call(this)
  this.show = function(){
    fill(this.c)
    rect(this.x,this.y,20*this.size,80*this.size)
  }
}

function L(){
 Shape.call(this)
  this.show = function(){
    fill(this.c)
    rect(this.x,this.y,20*this.size,80*this.size)
    rect(this.x+(20*this.size),this.y,20*this.size,20*this.size)
  }
}

function Triangle(){
  Shape.call(this)
  this.show = function(){
    fill(this.c)
    rect(this.x,this.y,60*this.size,20*this.size)
    rect(this.x+(20*this.size),this.y-(20*this.size),20*this.size,20*this.size)
  }
}

function Step(){
  Shape.call(this)
  this.show = function(){
    fill(this.c)
    push()
    //rotate(radians(180))
    rect(this.x-(10*this.size),this.y,40*this.size,20*this.size)
    rect(this.x+(10*this.size),this.y+(20*this.size),40*this.size,20*this.size)
    pop()
  }
}

function setup(){
  var myCanvas = createCanvas(800,800); //you must keep this line unmodified
  shapes = []
  for(i=0;i<10;i++){
    shapes.push(new Square)
    shapes.push(new Line)
    shapes.push(new L)
    shapes.push(new Step)
    shapes.push(new Triangle)
  }

}

function draw() {
  background(0)
  noStroke()
  //start writing your code here
    for(i=0;i<shapes.length;i++){
     shapes[i].move()
     shapes[i].show()
  }
}