Rheolism

Rheolism is a one line game written by Martin Hollis and David Moore with help from Olly Betts.

The code:


    0d=d:IFdVDUd:a=POINT(32*POS,31-VPOS<<5):RETURNELSEMODE9:GCOL-9:CLG:O
FF:d=9:REPEATVDU30:REPEATGOSUBFALSE:IFPOS=28VDUPOS,15,VPOS,24;11,26:IF0E
LSEIFa=0PRINT:UNTIL0ELSEUNTILVPOS=25:v=ABSRNDMOD7:i=0:VDU4895;3:REPEATm=
9-INKEY6MOD3:FORr=TRUETO1:t=rANDSGNt:IFt=rCOLOURv-15:VDUrEORm:i+=m=7AND9
-6*r:IF0ELSEFORn=0TO11:d=n/3OR2EORd:GOSUBFALSE:IF1<<(n+i)MOD12AND975AND&
C2590EC/8^vVDU2080*ABSr;:t+=a:IF0ELSENEXT,:VDU20:UNTILt*LOGm:UNTILVPOS=3

Features

Introduction

What is Rheolism?

Rheolism is the result of a challenge to write a Tetris like puzzle game in one-line of BBC BASIC. One line BASIC programs are the obfuscated C programs of the old microcomputer world.

There were a number of similar programs written in BBC BASIC, the language provided with Acorn computers. These programs were an attempt to cram as much functionality as possible into a tiny amount of code. Often with pretty or amusing results. Rheolism is an attempt to do something more impressive than had been done before.

The program was written some time ago. The result may still be of interest and amusement to computer programmers.

What is Tetris?

Tetris is a puzzle game. Random tetrominoes playing pieces are positioned by the player as they drop into a box. The pieces may be rotated, and moved left or right. The game stops when the box fills up. The player tries to pack the pieces efficiently, and lines with no gaps are removed. The aim is to last as long as possible, before the box fills.

For a more precise explanation of what happens read the code.

The Challenge

The challenge was to write a one line program in BBC BASIC. The maximum length a line can be is 256 bytes (253 of which could be code). Ideally, the game should be recognisable, the program listable, and the game playable.

Unlike in the International Obfuscated C Code Contest, brevity and not obfuscation is the aim. The results, however, are not necessarily very different.

What is BBC BASIC?

BBC BASIC, is the language first provided with Acorn's BBC microcomputer. It was also implemented on a later Acorn machine, the ARM based Archimedes, and also runs on RiscPCs. The BBC BASIC interpreters have very good implementations that ran very quickly.

A BASIC interpreter executes programs directly from memory. This allows programs to be written and executed in a very small amount of memory. The programs are stored in a tokenized form, instead of pure ASCII. This allows the program to be displayed and modified, without it occupying a huge amount of space, which was at a premium on the BBC microcomputer that only has 16-32Kb of RAM. Tokenization also helps speed execution, as the interpreter can understand what action to perform more quickly than would be possible with raw ASCII.

Interpretation also provides the advantage of having an instant "edit-compile-run" cycle. BBC BASIC also provides access to simple to use graphic facilities. For a generation BBC BASIC made it quick, easy and fun to write programs and which could be colourful and interactive.

How long did it take?

It was written over a period of about ten weeks in 1992.

Are there any bugs?

Yes, read the bugs section.

If it's a one-line program, why is it more than one line?

A line of code is not the same as a line on a screen. The program won't fit on one line on most screens, but it will fit on one line of BBC BASIC, which fortunately has a well defined, but short maximum length of 256 characters. The whole program is 257 bytes as there is an extra byte to mark the end of the program.

How does it work?

Well I'd like to think it is self documenting. The code speaks for itself; even if what it has to say is not very nice. The variable names and the filename are comments. The variable names are the letters of our first names, and the filename "Rheolism" is made up of the letters of our surnames. What the code does can be deduced by reading it.

But how does it work?

For those who are not familiar with BBC BASIC, I've written an explanation of the code that spells out in detail how every byte works.

How was Rheolism written?

Basically by writing a 1200 byte program, then making it more than four times smaller.

To understand the process and the techniques used, read the section about writing small programs. Read the history of the program for concrete examples of the techniques or just find out more detail than you care about.

Extra Rheolism

Extra Rheolism is Olly Betts' latest version of the game with added features!


David Moore
$Id: index.html,v 1.18 2001/07/01 14:45:44 dsm Exp $