Produce a graphical or ASCII-art representation of a Sierpinski pentagon (aka a Pentaflake) of order 5. Your code should also be able to correctly generate representations of lower orders: 1 to 4.





See also
 Sierpinski pentagon


PROC Main()
  INT ARRAY xs=[249 200 96 80 175]
  BYTE ARRAY ys=[82 176 159 55 7]
  INT x,y
  BYTE i,CH=$02FC,COLOR1=$02C5,COLOR2=$02C6
 
  Graphics(8+16)
  Color=1
  COLOR1=$0C
  COLOR2=$02
 
  x=160+Rand(30)
  y=96+Rand(30)
  DO
    i=Rand(5)
    x=x+(xs(i)-x)*62/100
	y=y+(ys(i)-y)*62/100
    Plot(x,y)
  UNTIL CH#$FF
  OD
  CH=$FF
RETURN