Produce a graphical representation of a Sierpinski triangle of order N in any orientation.

An example of Sierpinski's triangle (order = 8) looks like this: 




link wopen
 
procedure main(A)
   local width, margin, x, y
 
   width := 2 ^ (order := (0 < integer(\A[1])) | 8)
   wsize := width + 2 * (margin := 30 )
   WOpen("label=Sierpinski", "size="||wsize||","||wsize) | 
      stop("*** cannot open window")
 
   every y := 0 to width - 1 do
      every x := 0 to width - 1 do
         if iand(x, y) = 0 then DrawPoint(x + margin, y + margin)
 
  Event()
end