ZX81 Sierpiński triangle update

9Liner BASIC ZX81 Sierpinski triangle generator program output
ZX81 Sierpinski triangle (improved version)

Recently I became aware of the BASIC 10Liner Contest and thought that my program for generating the Sierpinski triangle fractal on the Sinclair ZX81, if properly adapted, could be a suitable entry to the “SCHAU” category. In fact, this category includes demos, tools and applications coded in 10 lines (max 256 characters per logical line), while other categories are specific for games.

So, I took the opportunity to rewrite the code, in order to:

  • reduce the program length (10 lines maximum);
  • improve the generated picture quality.

The resulting listing is shown below: the program is actually 9 lines long and, by choosing the points: (X=0, Y=0), (X=30, Y=40) and (X=0, Y=60) as triangle vertices, the quality of the generated image is considerably improved.

9Liner BASIC ZX81 Sierpinski triangle generator program listing
10 (actually 9!) liner ZX81 Sierpinski triangle BASIC program listing

Bonus: for a real retro-experience (with a modern web browser), here You can see the TELETEXT version of the BASIC listing and program output!

You can either download a .zip containing the program source code, emulator ready-to-use file and full documentation, or just see it in action with the online ZX81 emulator.
On successful load, you should see a white screen with the “0/0” message on the bottom. To start the program, tap the “R” key (you should now see “RUN” followed by a black cursor on the bottom of the screen), followed by the “ENTER” key.

Enjoy the SCHAU! 😉

Leggi in Italiano

Leave a comment

Your email address will not be published. Required fields are marked *