Named
after an 18th-century French monk, Truchet tiles
are being used by Clifford A. Pickover of IBM's
Thomas J. Watson Research Center to transform large
masses of binary data into visual form. His object is to
determine the relative randomness of his data using a quick, visual tool.
are being used by Clifford A. Pickover of IBM's
Thomas J. Watson Research Center to transform large
masses of binary data into visual form. His object is to
determine the relative randomness of his data using a quick, visual tool.
by Frank Kweder
Truchet tiles were a topic of discussion in the "Computer Recreations" column of Scientific American (July 1989). Named after an 18th-century French monk, Truchet tiles are be ing used by Clifford A. Pickover of IBM's Thomas J. Watson Research Center to transform large masses of binary data into visual form. His object is to determine the relative randomness of his data using a quick, visual tool.
There are two types of tiles (see Figure I), each composed of two quarter-circle arcs whose centers are located at opposite corners of a square. The radius of each circle is equal to half the length of the side of the square, thus, when tiled, the pattern is connected continuously. Tile #1 is the mirror image of Tile #0. Alternatively, you might think of Tile #l as being rotated 90 degrees in either direction.
The program presented here has no scientific significance. It merely demonstrates some of the graphical design possibilities. When the program is first run, a preset pattern (Figure 2) is drawn using data statements. The pattern contains three main figures: a large flower-like circular figure, a large "X" shape and a smaller circle.
Press the space bar and a new pattern will be drawn by random placement of the tiles (Figure 3). After running this many times, I have noticed that the flower and "X" patterns almost never appear. The small circles, however, are common.
The larger patterns are created by a sequence of tiles in a 4x4 grid. The "X" pattern requires a repeated sequence involving 16 tiles and the "flower" requires 12 tiles. The small circle uses only four tiles. Therefore, it's logical that the "X" is least likely to appear.
Another press of the space bar will plot another random pattern. This time the figure is simplified by removing the lines defining the tile edges. The next press of the space bar will plot a lull-screen pattern (Figure 4).
When the plotting is finished, you may replot it or print the plot using an Epson-compatible printer and the G. Device from ANALOG's October '85 issue (and on this month's disk). The file G.OBJ must be loaded before running Truchet Tiles. If G.OBJ is not loaded, an attempt to print will abort and the program wilt remind you to load it. Alternatively, you may want to add your own screen-dump or screen-save routine.
Try printing out some screens and filling in the maze-like channels the pattern forms with different colored markers, highlighters or crayons. This is a great way to keep the kids occupied and not bad therapy for anyone who has been at the keyboard for too long!
Programming
Notes
A display list interrupt (DLI) is used to show the
title and the type of plot being drawn. Within the DLI, I also used
fine scrolling to present a caption or instructions, and to draw your
attention to the next operation.The DLI sets Line 0 to Graphics 2 and Line 1 to Graphics 1. Line 1 also has its vertical-scroll bit set (+ 32). All you have to do is scroll the contents of Line 1 up eight bits while POKEing the bit number into 54277, the vertical-scroll register. Next, rewrite the contents of Line 1 and then scroll down eight bits, again POKEing the bit number into 54277. Check out the "Master Memory Map, Part IX" in the April '89 ANALOG Computing, where there is an excellent account of this interesting register.
I hope you enjoy Truchet Tiles. As for me, I must return to my copy of Scientific American and try to figure out how to keep the Biomorphs from eating all the fractal popcorn!
Frank Kweder, an owner of both a 130XE and an ST, reads his Scientific Americans in Ft. Myers, Florida.
LISTING 1: BASIC
BLUE indicates inverse video
EI 1 REM *******************************
JG 2 REM * ATARI TRUCHET TILES *
XH 3 REM * by Frank Kweder *
TB 4 REM * *
TC 5 REM * *
VS 6 REM * COPYRIGHT 1989 *
LW 7 REM * BY ANALOG COMPUTING *
EP 8 REM *******************************
NO 9 REM
LV 10 GRAPHICS 24:COLOR 1:POKE 764,255
GH 15 POKE 708,138:POKE 709,14:POKE 710,0
:POKE 711,60:POKE 712,64:POKE 559,0
EN 20 POKE 752,1:G=1:VSCROLL=32:J=1:SPACE
=33
BL 45 REM
RW 49 REM DRAW PATTERN FROM DATA
JH 50 GOSUB 300:GOSUB 760
FI 55 FOR Z=2 TO 11 STEP 2:PLOT 0,Z:DRAWT
O 319,Z:NEXT Z
SY 60 FOR R=12 TO 154 STEP 12:FOR C=9 TO
300 STEP 12
DA 65 IF J=5 THEN J=1:RESTORE 1000
SX 70 READ V1:GOSUB 420:NEXT C:J=J+1
MI 75 NEXT R
DF 80 FOR Z=155 TO 167 STEP 2:PLOT 0,Z:DR
AWTO 319,Z:NEXT Z
SC 198 REM
RD 199 REM VERTICAL SCROLL ROUTINE
AP 200 POKE 87,0:FOR A=0 TO 7
LF 210 POKE 54277,A:Z=SIN(A):NEXT A
SK 220 Z=COS(A):POSITION 24,0:? "press__s
pace";
QB 230 FOR A=7 TO 0 STEP -1
LL 240 POKE 54277,A:Z=SIN(A):NEXT A
LO 250 FOR Z=1 TO 200:NEXT Z
HP 260 ON PEEK(764)=SPACE GOTO 500+300*(G
=2):GOTO 200
SD 298 REM
WR 299 REM SET UP DLI & VERTICAL SCROLL
FN 300 DL=PEEK(560)+256*PEEK(561)
FL 310 POKE DL+3,64+7:POKE DL+6,6+VSCROLL
QT 311 REM
UC 312 REM SHIFT 4K BOUNDARY DOWN 1 LINE
CQ 315 POKE DL+102,PEEK(DL+101):POKE DL+1
01,PEEK(DL+100)
BF 316 POKE DL+100,PEEK(DL+99):POKE DL+99
,PEEK(DL+98)
RO 318 REM
RL 319 REM CLEAN UP BOTTOM OF SCREEN
XS 320 POKE DL+174,65:POKE DL+175,PEEK(56
0):POKE DL+176,PEEK(561)
ZF 330 RETURN
SE 398 REM
RK 399 REM PLOT RANDOM DESIGN
OZ 400 V1=INT(PEEK(53770)/128)
GO 420 ON V1+1 GOTO 430,450
RR 428 REM
JL 429 REM PLOT AT 430 IF V1=0
XB 430 PLOT C+5,R:DRAWTO C+5,R+2:DRAWTO C
+2,R+5:DRAWTO C,R+5
CP 432 PLOT C+6,R:DRAWTO C+6,R+2:DRAWTO C
+2,R+6:DRAWTO C,R+6
ES 434 PLOT C+11,R+5:DRAWTO C+9,R+5:DRAWT
0 C+5,R+9:DRAWTO C+5,R+11
KS 436 PLOT C+11,R+6:DRAWTO C+9,R+6:DRAWT
0 C+6,R+9:DRAWTO C+6,R+11
DO 438 IF G<3 THEN PLOT C+11,R:DRAWTO C+1
1,R+11:PLOT C+11,R+11:PLOT C+9,R+11
IQ 439 IF G<3 THEN PLOT C+7,R+11:PLOT C+5
,R+11:PLOT C+3,R+11:PLOT C+1,R+11
ZI 440 RETURN
RU 448 REM
MD 449 REM PLOT AT 450 IF V1=1
YC 450 PLOT C+5,R:DRAWTO C+5,R+2:DRAWTO C
+9,R+6:DRAWTO C+11,R+6
VT 452 PLOT C+6,R:DRAWTO C+6,R+2:DRAWTO C
+9,R+5:DRAWTO C+11,R+5
VJ 454 PLOT C,R+5:DRAWTO C+2,R+5:DRAWTO C
+6,R+9:DRAWTO C+6,R+11
TP 456 PLOT C,R+6:DRAWTO C+2,R+6:DRAWTO C
+5,R+9:DRAWTO C+5,R+11
DS 458 IF G<3 THEN PLOT C+11,R:DRAWTO C+1
1,R+11:PLOT C+11,R+11:PLOT C+9,R+11
IU 459 IF G<3 THEN PLOT C+7,R+11:PLOT C+5
,R+11:PLOT C+3,R+11:PLOT C+1,R+11
ZM 460 RETURN
SF 498 REM
VK 499 REM DRAW BY PLOTTING RANDOM #
QR 500 PUT #6,125:COLOR 1:G=2:GOSUB 700
WC 510 FOR R=1 TO 154 STEP 12:FOR C=9 TO
300 STEP 12
AK 520 GOSUB 400:NEXT C:NEHT R
AV 530 POKE 764,255:GOTO 80
SH 698 REM
RX 699 REM MESSAGES AND BORDERS
UK 700 POSITION 0,0:POKE 87,0:? "___TRUCH
ET__TILES___";
ZI 710 IF G=1 THEN ? "_______pattern_____
_";
IZ 720 IF G=2 THEN ? "_______random______
-";
OK 730 POKE 87,8:POKE 764,255:POKE 559,34
HU 740 FOR Z=1 TO 8 STEP 2:PLOT Z-1+Z/3,1
:DRAWTO Z-1+Z/3,176:PLOT 319-Z-Z/3,1
IC 750 DRAWTO 319-Z-Z/3,176:NEXT Z:RETURN
SI 798 REM
JF 799 REM PLOT FULL SCREEN TO PRINT
HG 800 GRAPHICS 8+16:G=3
VM 810 COLOR 1:POKE 710,0:POKE 712,128
QV 820 PLOT 4,0:DRAWTO 315,0:DRAWTO 315,1
91:DRAWTO 4,191:DRAWTO 4,0
XV 830 FOR R=0 TO 191 STEP 12:FOR C=4 TO
305 STEP 12
AR 840 GOSUB 400:NEXT C:NEXT R
RZ 848 REM
NG 849 REM MENU
CM 850 GRAPHICS 8+32:POKE 710,0:POKE 752,
1:POKE 764,255
FM 860 ? "":? " -1 PLOT AGAIN -2 PRIN
T -3 END";
CS 870 CLOSE #1:OPEN #1,4,0,"K:":GET #1,A
:A=A-48
VA 880 ON A GOTO 800,890,990:GOTO 870
TR 890 GRAPHICS 8+16+32:POKE 709,0
SJ 898 REM
DP 899 REM PRINT WITH G: DEVICE
UO 900 TRAP 989
KH 910 CLOSE #7:OPEN #7,8,0,"G3:"
BX 920 XIO 64,#7,3,0,"G3:":GOTO 850
XM 989 ? "↓↓↓ ???? G.OBJ NOT INSTALLED
????":TRAP 40000
LG 990 GRAPHICS 0:END
SN 999 REM
QY 1000 REM DATA FOR PATTERN
BC 1001 DATA 1,0,1,0,1,0,1,0,1,0,1,0,1,0,
1,0,1,0,1,0,1,0,1,0,1
ZX 1002 DATA 0,0,1,1,1,0,0,0,1,1,1,0,0,0,
1,1,1,0,0,0,1,1,1,0,0
BK 1003 DATA 1,1,0,0,0,1,1,1,0,0,0,1,1,1,
0,0,0,1,1,1,0,0,0,1,1
AF 1004 DATA 0,1,0,1,0,1,0,1,0,1,0,1,0,1,
0,1,0,1,0,1,0,1,0,1,0