! Dragon curve
PICTURE D(n)
   IF n=0 THEN        
      SET AREA COLOR 2
      PLOT AREA: 0,0; 1/2,0; 1/2,1/2; 0,0
      SET AREA COLOR 3
      PLOT AREA: 1,0; 1/2,1/2; 1/2,0; 1,0
   ELSE
      DRAW D(n-1) WITH ROTATE(alfa)*SCALE(r)
      DRAW D(n-1) WITH SHIFT(-1,0)*ROTATE(alfa)*SCALE(r)*SHIFT(1,0)
   END IF
END PICTURE
SET WINDOW -1/2,3/2,-1,1
LET alfa=PI/4
LET r=1/SQR(2)
FOR n=0 TO 12
   CLEAR
   DRAW D(n)
   WAIT DELAY 1
NEXT n
END

