title: building a brick pyramid
body: <p>The problem I'm trying to solve is building a pyramid centered in the window built with individual bricks. With the code blow I expect the there should be 1 brick on the 1st row, two bricks on the 2nd row, 3 on the 3rd row all the way up to 12 bricks on the base of the pyramid. Instead only 1 brick is appearing in the center of the screen. What could I do to correct my code? </p>
  
  <pre><code>import acm.program.*;
  import acm.graphics.*;
  
  
  
  public class BrickPyramid extends GraphicsProgram{          
  
          public void run() {
           /** xBrick, yBrick trying to calculate for the center of the window **/ 
  
           double xBrick = (getWidth() - BRICK_WIDTH) / 2 ;              
           double yBrick = (getHeight() - BRICK_HEIGHT) /2 ; 
  
           /** getting the size of the brick by multiplying the brick width by brick height **/ 
           double buildingBrick = BRICK_WIDTH * BRICK_HEIGHT; 
  
             for (int i = 0 ; i &lt;= 12; i ++ ){
                 for (int j = 0; j &lt; BRICKS_IN_BASE; j++){
  
                     double x = i * buildingBrick; 
                     double y = j * buildingBrick; 
  
  
                 /* adding the brick with starting point xbrick, ybrick **/
                     GRect brick = new GRect (xBrick, yBrick, BRICK_WIDTH, BRICK_HEIGHT);
                     add(brick);
  
                 } 
             }
  
      }
  private static final int  BRICK_WIDTH = 100;
  private static final int  BRICK_HEIGHT = 50;
  private static final int BRICKS_IN_BASE = 12;
  }
  </code></pre>