--- title: "The Chaos Game (Sierpinski’s Gasket)" id: 77356 type: "computer_media" slug: "the-chaos-game-sierpinskis-gasket" url: "http://localhost/computer_media/the-chaos-game-sierpinskis-gasket/" markdown_url: "http://localhost/computer_media/the-chaos-game-sierpinskis-gasket.md" published_at: "2026-11-15T18:39:03+00:00" modified_at: "2026-11-15T18:39:03+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/chaos-game-sierpinski-1.png" excerpt: "Plots Sierpinski's Gasket, the fractal of the Chaos Game, by repeatedly moving half-way to a randomly chosen corner of a triangle." post_tag: - name: "LKDOS" slug: "lkdos" taxonomy: "post_tag" url: "http://localhost/tag/lkdos/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Tim Swenson" slug: "tim-swenson" taxonomy: "indiv" url: "http://localhost/indiv/tim-swenson/" genre: - name: "Graphics" slug: "graphics" taxonomy: "genre" url: "http://localhost/type/graphics/" media_type: "Program" programmers: - name: "Tim Swenson" slug: "tim-swenson" taxonomy: "indiv" url: "http://localhost/indiv/tim-swenson/" mediadate: "1990" images: - url: "http://localhost/wp-content/uploads/2026/11/chaos-game-sierpinski-1.png" - url: "http://localhost/wp-content/uploads/2026/11/chaos-game-sierpinski-2.png" article_media: - id: 23182 title: "Chaos Game" type: "article" url: "http://localhost/article/chaos-game/" media_type_tags: "Graphics" license: false --- # The Chaos Game (Sierpinski’s Gasket) 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](https://timexsinclair.com/article/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 1 ```