koreth@panarthea.ebay.sun.com (Steven Grimm) (06/02/90)
Submitted-by: WJOHNSTON@COLGATEU.BITNET (Michael Johnston) Posting-number: Volume 3, Issue 61 Archive-name: chaos 10 'This program, written in ST Basic, draws the "Sierpinski 20 'Triangle" in randomly-selected sizes and shapes. It illustrates 30 'some principles of chaos theory, such as fractals and self- 40 'similarity, bounded randomness, and constant complexity 50 'across orders of scale. A discussion of the "affine transfor- 60 'mations" used to create this diagram was presented on the PBS 70 'program "Nova" in January 1989, and also in the May 1990 issue 80 'of SCIENTIFIC AMERICAN. Have fun with this one-- 90 ' Michael Johnston (WJOHNSTON@COLGATEU.BITNET) 100 FULLW 2:CLEARW 2:CT=0 110 'You can change colors by playing with line 130; green on 120 'black is nice, for example. 130 COLOR 1,1,1 140 FOR C=1 TO 3 150 RANDOMIZE 0 160 XC(C)=RND(0) 170 XC(C)=XC(C)*1000 180 IF XC(C)>606 THEN 150 190 NEXT 200 FOR C=1 TO 3 210 RANDOMIZE 0 220 YC(C)=RND(0) 230 YC(C)=YC(C)*1000 240 IF YC(C)>166 THEN 210 250 NEXT 260 PCIRCLE XC(1), YC(1), 1 270 PCIRCLE XC(2), YC(2), 1 280 PCIRCLE XC(3), YC(3), 1 290 RANDOMIZE 0 300 X=RND(0) 310 X=X*1000 320 IF X>606 THEN 290 330 RANDOMIZE 0 340 Y=RND(0) 350 Y=Y*1000 360 IF Y>166 THEN 330 370 GOTO 440 380 XCH=(X-XC(1))/2:YCH=(Y-YC(1))/2:GOTO 410 390 XCH=(X-XC(2))/2:YCH=(Y-YC(2))/2:GOTO 410 400 XCH=(X-XC(3))/2:YCH=(Y-YC(3))/2 410 NX=X-XCH:NY=Y-YCH:IF CT < 15 THEN 430 420 PCIRCLE NX, NY, 0 430 X=NX:Y=NY 440 RANDOMIZE 0:CT=CT+1 450 D=RND(0)*10 460 IF D=6 OR D>6 THEN 440 470 D=INT(D) 480 IF D=0 OR D=1 THEN 380 490 IF D=2 OR D=3 THEN 390 500 IF D=4 OR D=5 THEN 400