"I do believe that he takes too much pride in the brevity of his work" - Mr. Talbot, my geography teacher at age 14


Rheolism in action

Rheolism is a one-line BBC BASIC V Tetris game. It was written by David Moore and Martin Hollis (with assistance from me), after Martin bet David he couldn't do it.

RISC OS Version

Extra Rheolism is my enhanced version, which fixes two bugs in the original, and implements the following additional features:

The scoring is based on how far down each brick falls. The lower it lands, the greater the score.

The game features multiple key-sets. Either shift is the drop key, and for example '4', '5', and '6' work as left, rotate and right.

This version has been play-tested on an ARM3 A440, with the cache on and off, and the speed chosen accordingly. If you want to change the speed, alter the 6 in the INKEY on line 4, but remember it can only be a single digit. It should be compatible with RISC OS 2 and RISC OS 3. It will run on a Risc PC without modification, provided your monitor can display MODE 9.

The one line is a byte short of maximum length when tokenised, and so very hard to type in. Hence, it is distributed in the form of a file which should be *Exec-ed. If your WWW viewer allows, cut out the listing and save it, set the filetype to 'Command' and double-click on it. This produces the one line BASIC program, so save it and start playing!

If you want to edit it, I suggest you keep the Command file, as neither the Basic Editor nor !Zap are very happy about the BASIC version.

I'd be very interested if anyone can save 2 more bytes (not including removing 'OFF:' or ':Z') as I have a mechanism for making the game get gradually faster that is quite playable and needs 7 more bytes.

Anyway, here is V2.0 (which is a byte shorter than the V1.0):

| Extra Rheolism - a one line Tetris game
6IFt=r COLOURv-15:VDUr EORm:i+=m=7AND9-6*r:IF0ELSE
7FORn=0TO11:d=n DIV3OR2EORd:VDUd:
8IF1<<(n+i)MOD12AND&C2590EC DIV8^v AND975 t+=POINT(p*POS,31-VPOS<<5):IFr VDUp,8:IF0ELSE
b=PA.+4:F.a=b TOTOP:?b=?a:b=b-(?b<>32):a=a-4*(a?1=13):N.

And here's what it looks like as one line, wrapped at 80 columns:


I gave a talk at OSDC 2011 about this: The Art of Writing Small Programs. [VIDEO] (youtube)

David Moore has written an excellent explanation of how Extra Rheolism works.

BBC Micro Version

In early 2020 I came across the marvellous jsbeeb which provides a cycle-accurate emulation of a BBC micro in the browser. My first thought on seeing it was whether I could get a version of Extra Rheolism working on it.

David discussed some of the additional challenges this adds to the mix. He makes an attempt but it is too long to fit in a single line, yet lacks some features compared to even the original Rheolism (for example, the game never actually ends but instead draws new shapes on top of each over forever).

The BBC BASIC V on RISC OS added a number of additional features over BBC BASIC II on the BBC micro and Rheolism and Extra Rheolism rely on a number of these. There's also one quirk exploited by Extra Rheolism (TAB(x) when x < 0 being a no-op) which doesn't work on a BBC Micro - there TAB(x) seems to implicitly perform TAB(x AND255).

After a lot of experimentation I managed to get a working version. This even includes scoring (using a different scoring mechanism). Here's what it looks like, again wrapped at 80 columns:


The missing features compared to the RISC OS version of Extra Rheolism are:

The scoring code uses 7 bytes, so could be traded for a full set of block shapes and an end of game message, plus 2 spare bytes.

This works on the original BBC Model B, but not on a BBC Master - the reason is that the latter defines character 255 as a solid block so when we read a character from the screen we get 255 instead of 0 when there's a block.

Click here to play in jsbeeb. Multiple key-sets are supported, but e.g. "4" and "6" shift left and right while "5" rotates.

You can look at the code by hitting "Escape", then MODE7 to switch to a more readable screen mode and LIST to show the program. RUN will start a new game.

I gave a short talk at WOSSAT in February 2020 about this: Another Brick in the Wall. [VIDEO] (youtube)

Last updated 2020-07-13

[Home page]