Task
Produce a graphical or ASCII-art representation of a  Sierpinski arrowhead curve  of at least order  3.




int  PosX, PosY;
real Dir;
 
proc Curve(Order, Length, Angle);
int  Order; real Length, Angle;
[if Order = 0 then
        [PosX:= PosX + fix(Length*Cos(Dir));
         PosY:= PosY - fix(Length*Sin(Dir));
         Line(PosX, PosY, $E \yellow\);
        ]
else    [Curve(Order-1, Length/2.0, -Angle);
         Dir:= Dir + Angle;
         Curve(Order-1, Length/2.0, +Angle);
         Dir:= Dir + Angle;
         Curve(Order-1, Length/2.0, -Angle);
        ];
];
 
def Order=5, Length=300.0, Pi=3.141592654, Sixty=Pi/3.0;
[SetVid($12);   \VGA graphics: 640x480x8
PosX:= 640/4;  PosY:= 3*480/4;
Move(PosX, PosY);
Dir:= 0.0;
if (Order&1) = 0 then
        Curve(Order, Length, +Sixty)
else    [Dir:= Dir + Sixty;
        Curve(Order, Length, -Sixty);
        ];
]