|
!'Truchet Tiling
CALL GINIT(600,600)
RANDOMIZE
LET H=50
FOR Y=H TO 600-H STEP 2*H
FOR X=H TO 600-H STEP 2*H
IF RND<.5 THEN CALL P1(X,Y,H) ELSE CALL P2(X,Y,H)
!' IF RND<.5 THEN CALL L1(X,Y,H) ELSE CALL L2(X,Y,H)
NEXT X
NEXT Y
END
EXTERNAL SUB P1(X,Y,H)
PLOT LINES
FOR I=270 TO 360
LET XX=X-H+H*COS(RAD(I))
LET YY=Y-H-H*SIN(RAD(I))
PLOT LINES:XX,YY;
NEXT I
PLOT LINES
FOR I=90 TO 180
LET XX=X+H+H*COS(RAD(I))
LET YY=Y+H-H*SIN(RAD(I))
PLOT LINES:XX,YY;
NEXT I
END SUB
EXTERNAL SUB P2(X,Y,H)
PLOT LINES
FOR I=180 TO 270
LET XX=X+H+H*COS(RAD(I))
LET YY=Y-H-H*SIN(RAD(I))
PLOT LINES:XX,YY;
NEXT I
PLOT LINES
FOR I=0 TO 90
LET XX=X-H+H*COS(RAD(I))
LET YY=Y+H-H*SIN(RAD(I))
PLOT LINES:XX,YY;
NEXT I
END SUB
EXTERNAL SUB L1(X,Y,H)
PLOT LINES:X,Y-H;X-H,Y
PLOT LINES:X+H,Y;X,Y+H
END SUB
EXTERNAL SUB L2(X,Y,H)
PLOT LINES:X,Y-H;X+H,Y
PLOT LINES:X-H,Y;X,Y+H
END SUB
EXTERNAL SUB GINIT(XSIZE,YSIZE)
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0,XSIZE-1,YSIZE-1,0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
SET COLOR MIX(0) 0,0,0
SET COLOR MIX(1) 0,0,1
SET COLOR MIX(2) 1,0,0
SET COLOR MIX(3) 1,0,1
SET COLOR MIX(4) 0,1,0
SET COLOR MIX(5) 0,1,1
SET COLOR MIX(6) 1,1,0
SET COLOR MIX(7) 1,1,1
CLEAR
SET LINE COLOR 7
END SUB
|
|