Plots Sierpinski’s Gasket with the Chaos Game: from a random starting point it repeatedly picks one of three corners of a triangle at random and plots the point half-way there. After a few thousand points the fractal triangle-of-triangles appears, white on black, with a short beep every 250 points. It runs until you BREAK.
As printed, line 120 has no colour after BORDER, so the program stops at once with C Nonsense in BASIC. Line 9000 saves the program to a Larken disk (PRINT USR 100).
Published in Sinc-Link September-October 1990 (Chaos Game).
Source Code
100 REM The Chaos Game.
105 REM This produces a fractal figure called "Sierpinski's Gasket"
110 REM By Tim Swenson,July 1990
120 CLEAR 65535: BORDER : LET n=0
140 PAPER 0: INK 7: CLS
145 PRINT " SIERPINSKI'S GASKET"
150 PLOT 10,10
160 PLOT 75,135
170 PLOT 135,10
180 LET x=RND*99
190 LET y=RND*99
210 LET x1=x: LET n=n+1
220 LET y1=y
230 LET roll=INT (.5+RND*3)
240 IF roll=1 THEN LET x2=10: LET y2=10
250 IF roll=2 THEN LET x2=75: LET y2=135
260 IF roll=3 THEN LET x2=135: LET y2=10
270 LET x=(x1+x2)/2
280 LET y=(y1+y2)/2
290 PLOT x,y
300 IF n/250=INT (n/250) THEN BEEP .1,.1
310 GO TO 210
9000 PRINT USR 100: SAVE "chaos.B1" LINE 1Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

