public void paint(Graphics g) {
            //paint the background
            g.setColor(Color.BLACK);
            g.fillRect(0, 0, TILE_WIDTH*width, TILE_HEIGHT*height);
            
            // Only continue if there is a controller
            if (controller == null) { 
                return;
            }
            
            // Paint each element of the game board
            JManBoard board = controller.getBoard();
            for (int i= 0; i < width; i= i+1) {
                for (int j= 0; j < height; j= j+1) {
                    // tile (i, j) is in pixels (h..h1-1, v..v1-1)
                    int h  = i * TILE_WIDTH;
                    int h1 = (i+1) * TILE_WIDTH;
                    int v  = j * TILE_HEIGHT;
                    int v1 = (j+1) * TILE_HEIGHT;
                    
                    Piece piece = board.pieceAt(i,j);
                    if (piece != null) {
                        g.setColor(piece.getColor());
                        if (piece.getType() == Piece.BLOCK) {
                            // Tile is a block; fill it with a square.
                            g.fillRect(h+1, v, TILE_WIDTH-2, TILE_HEIGHT-2);
                        } else if (piece.getType() == Piece.JMAN){
                            // Fill J*Man's square with J*Man's Asterix Icon.
                            g.drawLine(h+3, v+2, h1-3, v1-2);
                            g.drawLine(h+3, v1-2, h1-3, v+2);
                            g.drawLine(h+1, v+TILE_HEIGHT/2, h1-1, v+TILE_HEIGHT/2);
                            g.drawLine(h+TILE_WIDTH/2, v+1, h+TILE_WIDTH/2, v1-1);
                        } else if (piece.getType() == Piece.WALKER){
                            //Tile is a walker, fill it with an appropriate colored triangle.
                            g.fillPolygon(new int[]{h+1, h1-1, h+TILE_WIDTH/2},
                                          new int[]{v1-2, v1-2, v}, 3);
                        } else if (piece.getType() == Piece.PILLAR){
                            // Tile is a pillar, fill it with an appropriate colored disk.
                            g.fillOval(h+1, v, TILE_WIDTH-2, TILE_HEIGHT-2);
                        }
                    }
                }
            }
        }