RUBE
====
EXPERIMENTAL VERSION - IN DEVELOPMENT       June 15 1997

implementation and grammar (c)1997, 2000 Cat's Eye Technologies.

RUBE is a twisted programming language named after Rube Goldberg,
creator of those convoluted cartoon machines.  It has some similarities
to said machines.  Read on.

Like Befunge, this is a 2-dimensional language where each instruction
is an ASCII character meant to be seen in debugging mode to be
appreciated.  Coincidentally (because I ripped off the Befunge-93
routines) it's currently restricted to an 80x25 source file.

There is no Program Counter as such - well there is, but it moves
like a scan line on a TV or monitor: every command in the program
is executed once every tick during a "sweep" of the program.  The
program changes on every tick.  You could say RUBE is just a 30+
state automaton with input and output functions, and you might be
right.

Anyone who's played The Incredible Machine (and to some extent,
Donkey Kong) will understand RUBE almost immediately.  Instructions
in the source file interact to execute the algorithm required.  A
"warehouse" paradigm is used (this is what happens to your brain
when you work at a lumberyard...)

Integral are the crates, 0 to f.  These represent data.  They also
represent movable boxes which are subject to gravity, being pushed
around, and conveyor belts, among other things.

Girders = are stationary parts of the program on which crates can
be piled.  When there's no girder directly below a crate, that crate
falls.

Dozers ( and ) push crates around.  Dozers are subject to gravity,
and must travel on girders.  Dozers turn around when there is a , in
front and above them.  As an interesting side effect they also
replicate themselves at ,'s.

Ramps / and \ are used for dozers to move from girder to girder.

Conveyor belts > and < carry crates along with no help needed from
dozers.  Note that conveyor belots do not affect dozer motion.

Winches up W and down M move crates from girder to girder.

"Swinches" move crates up V or down A and then switch states.

Gates K compare crates to a reference crate and move the crate
depending on if it's less than, or more than/equal to the
reference crate.

     t   | t = target crate     l = lesser crates
     K   | r = reference crate  g = greater than or equal to
    lrg  |

Packers + and Unpackers - perform 4-bit math on crates:

     +      +     -      -
    12  ->   3   ef  ->   1
    ===    ===   ===    ===

Furnaces F destroy everything one space left, right, below, and
above them.

Replicators : make a copy below them of whatever is above them,
usually a crate or a dozer.  Special replicators ; only make
copies of crates.  Upside-down special replicators . work like ;
but make a copy above them of what's below them.

Dozers turn around when they hit certain instructions.
Crumble walls * disappear after being hit horizontally by a dozer.

Program output provides a print mechanism.  If there is a c crate
below the O, the ASCII value specified by the two crates above the O
(if they exist) is output as an ASCII character.  If there is a b
crate below the O they are output as a byte value.

The following outputs a space:

        2
        0
        O
        c
        =

Symbol  Name                    Bump R  Bump L  Surface Gravity

Implemented:
        space                   pass    pass    no      no
0..f    crate                   move r  move l  yes     yes
(       dozer right             move r  move l  yes     yes
)       dozer left              move r  move l  yes     yes
=       girder                  rev     rev     yes     no
F       furnace                 die     die     die     no
\       ramp                    +1 elev +1 elev yes     no
/       ramp                    +1 elev +1 elev yes     no
>       conveyor belt right     rev     rev     yes     no
<       conveyor belt left      rev     rev     yes     no
:       replicator              rev     rev     yes     no
;       special replicator      rev     rev     yes     no
.       upside down replicator  rev     rev     yes     no
,       turn signal                             no      no
*       crumble-wall            break   break   yes     no
O       output                  rev     rev     yes     no
        b       byte<-crate crate
        c       char<-crate crate
K       gate                    rev     rev     yes     no
W       winch up                rev     rev     yes     no
M       winch down              rev     rev     yes     no
V       swinch up               rev     rev     yes     no
A       swinch down             rev     rev     yes     no
+       packer                  rev     rev     yes     no
-       unpacker                rev     rev     yes     no
C       crate killer            die cr  die cr  die cr  no
D       dozer killer            die doz die doz die doz no


Planned:
I       input                   input   input   yes     no
        b       byte->crate crate
        c       char->crate crate
T       scale                   rev     rev     yes     no
|       door                    rev     rev     yes     no


Kinda Silly (extraneous to real programming):
km      monkey                  rev     rev     yes     yes
wl      weasel                  rev     rev     yes     yes
H       mulberry bush           rev     rev     yes     yes

Q       supergoo                rev     rev     yes     kinda

~       water                   wet     wet     wet     kinda
u       pontoon                 rev     rev     yes     yes (floats)
sz      electric eel            die     die     die     yes

Sadly, the ubiquitous "Hello, world!" in RUBE is a very unfriendly


4666622767662
85ccfc07f2c41
OOOOOOOOOOOOO
ccccccccccccc
=============


Or an equally ugly


(21646c726f77202c6f6c6c6548
===========================

                           O F
                           c
                           =

