King James Hyperfuck

(For the sake of this post, it is better to consider the language non-profane.)

Brainfuck is an esoteric programming language based on a minimal Turing machine: it has a data tape and a code array, the instructions in the code modify the data in cells on the tape. Despite the presence of only a few simple instructions in the language it is theoretically possible to compute everything that can be computed within the Church/Turing model of computation; further an even more minimal derivative of Brainfuck, Boolfuck, restricts the data on the tape to consist only of single bits (either 0 or 1, instead of bytes from 0 to 255).

Now, consider changing the structure of the data 'tape', in particular extending it into a 2D hyperbolic plane. Hyperbolic geometry allows many parallel lines to a given line through a given point not on the line, with the consequence that the hyperbolic plane has exponentially more space than the common flat Euclidean plane.

Now, it is possible to tile the hyperbolic plane with congruent shapes, in many more ways than flat space can be tiled. For example, with one particularly shaped pentagonal tile, one can tile the hyperbolic plane in uncountably infinitely many ways. To navigate in this new arrangement of cells in this hyperbolic pentagonal tape, one adds three new instructions to the language: in addition to moving the cursor in the data tape East and West, new instructions allow moving North, South-East and South-West.

This best visualised in the Poincaré half-plane model of hyperbolic geometry, in which shapes are distorted to give a horizon at infinity to the South (compare with the Poincaré disk model in which there is a circular horizon at infinity, most popularized by M C Escher's Circle Limit I-IV prints).

This 2D hyperbolic modification of Boolfuck I call Hyperfuck, for fairly obvious reasons.

Now, the pentagonal tiling described above has a kind of tree-like memory property: if you proceed from a starting location and head North, you might enter the pentagon above from either its South-East edge or its South-West edge: this allows information to be encoded in the geometry of the initial configuration of the system. By modifying data in the cells and moving suitably, comparing the results of the movements with what you expect allows you to recover the stored bitstream. Further, this information need have no bound, for example one could encode an infinite library of every book ever written and that ever will be written (compare with Borges, the Shakespeare Typing Monkeys, and the text entry software Dasher).

However, a suitable source of information if a programmer is to be able to write useful programs more easily needs to be widely known and predictable: thus I propose the ASCII bitstream of a certain authorized version of the Christian Bible.

This liturgical modification of Hyperfuck I call King James Hyperfuck, for fairly obvious reasons.

A simple program can reconstruct the text; its source code:

+[^\;^+]

The current King James Hyperfuck interpreter is implemented in Haskell, using OpenGL to visualize the data tape, code tape, and output text. It also sends event information (the current instruction being executed) to Pure-data for sonification. There is also a (currently unfinished) SVG and ECMAScript version to run inside a web browser. The original prototype was implemented in C. Source code is available at maximus/kjhf at gitorious.org.