PRINT "input Sierpinski number 3 to 12: M" INPUT m PRINT "input CYCLIC GAP 0 TO 2*M" PRINT" EXAMPLE 1: 4,1---> NAZI CARPET" PRINT "EXAMPLE 2: 4,4---> CROSS CARPET" INPUT Q SET MODE "color" SET WINDOW 0,1920,0,1024 SET BACKGROUND COLOR "white" LET x=1 LET y=1 LET c=0 LET s1=600 LET s2 =s1*1024/1920 DIM a(25),b(25) FOR i=1 to m LET a(2*i-1)=cos(2*pi*i/m) LET b(2*i-1)=sin(2*pi*i/m) NEXT i FOR i=1 to m LET a(2*i)=(cos(2*pi*i/m)+cos(2*pi*(i-1)/m))/2 LET b(2*i)=(sin(2*pi*i/m)+sin(2*pi*(i-1)/m))/2 NEXT i PRINT " GENERAL SIERPINSKI I.F.S. of second kind: CYCLIC GAP driven " PRINT " BY R.L.BAGULA 23 feb 2002© copy rights reserved" RANDOMIZE PRINT " M=";m FOR n= 1 TO 2560000 LET c =RND LET l=1+int(c*2*m) REM A simple example of driven IFS: REM since FIRST AND SECOND order points are alway two apart in this array REM a CYCLIC GAP is imposed in the state machine REM by a modulo exclusion: odd numbers work first to second REM even numbers work first on first, second on second IF mod(d,2*m)<>mod(l+Q,2*m) THEN LET d=l LET x1=x/3+(a(l)-b(l))/sqr(2) LET y1=y/3+(a(l)+b(l))/sqr(2) END IF LET x=x1 LET y=y1 SET COLOR 255 IF n>10 THEN PLOT 1920/2+s1*x,1024/2+s2*y SET COLOR 32 NEXT n END