esolang

BrainSpace 1.0

Brainfuck's tape, steered by a Befunge pointer that bounces off PingPong mirrors.

SpaceMan++, 2008 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 2 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: meow

The idea

SpaceMan++ made BrainSpace 1.0 in 2008 from three languages. The memory is brainfuck's tape of cells. The program is a grid, read by a pointer that arrows turn as in Befunge, and / and \ are mirrors as in PingPong. There are no brackets. A loop is a path that comes back to where it began, and * and ? decide whether the pointer goes round again.

Read the story

Most commands have three spellings, a lower case letter, a capital and a symbol. So p, P and + all add 1.

The machine

CommandDoes
^ V v > <Point the pointer up, down, right or left
%Turn around
/ \Mirrors
*Skip the next cell if the memory cell is 0
?Turn around if the memory cell is not 0
p P +, m M -Add 1, take 1
l L {, e E }Move the tape left, right
o O 0, i I 1Print a byte, read one
x XEnd

The pointer starts at the top-left corner going right and wraps around the edges.

Example

A cat.

A cat. i reads a byte, * skips the turn down when it is 0 and reaches x, and otherwise the pointer goes down, prints, and comes round to read again.

The specification's own cat prints before it tests, so it prints the 0 from the end of the input as well.

A loop that prints five !. The first row puts 5 in one cell and 33 in the next. The second row is read right to left. It prints, steps back to the counter, takes 1, and * either lets the pointer turn down into the third row, which steps forward again and climbs back to <, or skips it and ends.

Expected: !!!!!

The Hello World test is 26 rows that zigzag down the grid, one letter for each pair of rows. It says a standard interpreter prints Hello world!, and it does in this implementation, but only when r and R move the tape right as e and E do. The specification's list of commands leaves them out, but without them the test never prints ! and never stops.

Patterns it teaches

Further

Two-dimensional languages

Write your own in Run Convert a program from BrainSpace 1.0

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: brainspace-1-0.

Command line

shib run brainspace-1-0 -e '+>*Vx  It moves right > down > left > up > right until the user typed nothing.
 o      This program demonstrates loops in BF
 i
 ^ <' --input 'abc'
shib manual brainspace-1-0

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/brainspace-1-0.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org