100 OPTION ARITHMETIC NATIVE
110 OPTION ANGLE DEGREES
120 PICTURE tragon(n,red,green,blue)
130    IF n=depth THEN
140       SET COLOR MIX (7) red,green,blue
150       PLOT POINTS: 0,0
160    ELSE
170       DRAW tragon(n+1,red+2^(-n),green,blue) WITH SCALE(1/SQR(3))*ROTATE(alpha) 
180       DRAW tragon(n+1,red,green+2^(-n),blue) WITH SHIFT(-2,0)*SCALE(1/SQR(3))*ROTATE(alpha)*SHIFT(2,0)
190       DRAW tragon(n+1,red,green,blue+2^(-n)) WITH SHIFT(-1,-SQR(3))*SCALE(1/SQR(3))*ROTATE(alpha)*SHIFT(1,SQR(3))
200    END IF
210 END PICTURE
220 SET POINT STYLE 1
230 SET POINT COLOR 7
240 SET WINDOW -3,5,-3,5
250 ASK PIXEL SIZE(-3,-3;5,5) px,py
260 LET depth=CEIL(-LOG(px-1)/LOG(1/SQR(3)))
270 LET alpha=0
280 DO
290    SET DRAW mode hidden
300    CLEAR 
310    DRAW tragon(1,0,0,0)
320    LET alpha=alpha+5
330    PLOT TEXT, AT -3,-3: "Press any to stop."
340    SET DRAW mode explicit
350    LET s$=""
360    CHARACTER INPUT nowait :s$
370    IF s$<>"" THEN EXIT DO
380 LOOP
390 END
