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


 
(* ****** ****** *)
//
// How to compile:
//
// patscc -DATS_MEMALLOC_LIBC -o sierpinski sierpinski.dats
//
(* ****** ****** *)
//
#include
"share/atspre_staload.hats"
//
(* ****** ****** *)
 
#define SIZE 16
 
implement
main0 () =
{
//
var x: int
//
val () =
for (x := SIZE-1; x >= 0; x := x-1)
{
  var i: int
  val () =
  for (i := 0; i < x; i := i+1)
  {
    val () = print_char(' ')
  }
  var y: int
  val () =
  for (y := 0; y + x < SIZE; y := y+1)
  {
    val y = g0int2uint_int_uint(y)
    val x = g0int2uint_int_uint(x)
    val () = print_string(if (x land y) != 0 then "  " else "* ")
  }
  val ((*flushed*)) = print_newline()
}
//
} (* end of [main0] *)
 