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


Procedure Triangle (X,Y, Length, N)
   If N = 0 
      DrawText( Y,X, "*",#Blue)
   Else
      Triangle (X+Length,          Y, Length/2, N-1)
      Triangle (X,   Y+Length,        Length/2, N-1)
      Triangle (X+Length, Y+Length*2, Length/2, N-1)
   EndIf
EndProcedure 
 
 
OpenWindow(0, 100, 100,700,500 ,"Sierpinski triangle",  #PB_Window_SystemMenu |1) 
StartDrawing(WindowOutput(0))
   DrawingMode(#PB_2DDrawing_Transparent )
   Triangle(10,10,120,5)
StopDrawing()
 
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
End