Task
Produce an ASCII representation of a Sierpinski triangle of order   N.



Example
The Sierpinski triangle of order   4   should look like this:

                       *
                      * *
                     *   *
                    * * * *
                   *       *
                  * *     * *
                 *   *   *   *
                * * * * * * * *
               *               *
              * *             * *
             *   *           *   *
            * * * *         * * * *
           *       *       *       *
          * *     * *     * *     * *
         *   *   *   *   *   *   *   *
        * * * * * * * * * * * * * * * *



Related tasks
 Sierpinski triangle/Graphical for graphics images of this pattern. 
 Sierpinski carpet


 
# Project : Sierpinski triangle
 
norder=4
xy = list(40)
for i = 1 to 40
    xy[i] = "                               "
next 
triangle(1, 1, norder)
for i = 1 to 36
    see xy[i] + nl
next 
 
func triangle(x, y, n)
     if n = 0
        xy[y] = left(xy[y],x-1) + "*" + substr(xy[y],x+1)
     else
        n=n-1
        length=pow(2,n)
        triangle(x, y+length, n)
        triangle(x+length, y, n)
        triangle(x+length*2, y+length, n)
     ok
 