Home

Awesome

Klickenklacker

Das Klickenklacker is the reference interpreter for the RUBE II automaton-like programming language.

Introduction

RUBE II: Das Klickenklacker, like its predecessor Rube, is an automaton-like system, where a set of objects are governed by the predetermined laws of "physics." Once constructed, the RUBE II program executes forever in time units known as frames, and so there is no "current-" or "next instruction," in the traditional programming sense.

Frames are not unlike frames in a movie, where each is a step in the action. Each frame is created from the last through the following a simple process of determining the next location for objects, resolving impending collisions between objects, and committing the resolved movements.

The collision resolution is made up of two parts: Precedence rules and recursive effects.

Objects and Collisions

Objects fall into three major categories. In order of their precedence, they are Stationary Objects, Motive Objects, and Moveable Objects.

Within each category of objects (except Stationary Objects, for obvious reasons), there are two axes of motion along which the object might move. The precedence of axes are ordered such that vertical movement is resolved before horizontal movement. Diagonal movement, if possible, is resolved after the "cardinal" movements have been resolved.

The only remaining precedence issues are along the same axis of motion, so-called head-to-head collisions. Within this case, there are two subcases. Each gives both objects the same precedence, but the collision must be handled differently in each case.

Forces

RUBE supports a single force, a pseudo-gravity which pulls all non-Stationary Objects downward at a rate of one location per frame. For purposes of conflict resolution, one can consider each object to have an implicit Motive Object above it, pushing downward.

That is, unless stopped, all objects (other than Stationary) will move downward, one location every frame.

Stationary Objects

As described before, Stationary Objects have the highest precedence, as befits their use as "operation nodes" and/or structural features. Among them are:

Structural

Structural Objects are Stationary Objects which do not alter Crates (see Moveable Objects). At most, they simply change the location of a nearby Object.

ObjectNameSpecial Features
=GirderNone
/Incline RightMotive force up 1 to right, left 1 to above
\Incline LeftMotive force up 1 to left, right 1 to above
>Right ConveyorMotive force right 1 to above
<Left ConveyorMotive force left 1 to above
WWinch UpMove below to above
MWinch DownMove above to below
VSwinch UpMove below to above, change to A
ASwinch DownMove above to below, change to V
,ReflectorReverse Dozers (see below) that pass below

Operational

Operational Objects are Stationary Objects which, in addition to being usable as Structural Objects Girder), also make modification to nearby Moveable Objects.

ObjectNameSpecial Features
+PackerAdds left to right, sum below
-UnpackerSubtracts right from left, result below
:ReplicatorCopy above to below
.Replicate UpCopy below to above
KGateMove above to left if less than below, move above to right if greater than below
FFurnaceDestroy surrounding

Note that Packers and Unpackers use Modular arithmetic. Only values 0 through f result.

Communications

Communications Objects act entirely like Girders, but also allow for communications with the outside world.

ObjectNameSpecial Features
IInputCreates input character nibbles below
NOutput NumberPrints nibble above
COutput CharPrints character represented by nibbles above

It should be noted that a RUBE II program may contain more than one Input Object (I). Should this happen, then input characters are delivered, each to a different Input Object in succession, from left to right, then top to bottom, like a scan line of a television. When no more Input Objects are available, the first one is used again.

Motive Objects

As mentioned above, Motive Objects move under their own power, and have a higher precedence than Moveable Objects, effectively pushing them to where they are (presumably) needed.

At this time, there are only three Motive Objects, plus the implicit Motive Object which handles gravity.

ObjectNameSpecial Features
(Right DozerMoves Right
)Left DozerMoves Left
^RocketMoves Up

Moveable Objects

Moveable Objects, as described above, are the data of the RUBE II program. They can be moved by Motive Objects, and manipulated by Stationary Objects.

ObjectNameSpecial Features
0..9CrateValues 0 through 9
a..fCrateValues 10 through 15