esolang

BrainFlump

One cell, and a dump you can throw values onto but only take back at random.

Dylan Renwick · Turing complete: no · ●○○ easy

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

Run it

Expected: abc

The idea

BrainFlump shrinks brainfuck's tape to a single cell. To keep a value for later you push it onto the dump with :. Getting one back with ; takes a random value out of the dump, so a program that stores more than one value cannot know which it gets.

The machine

One cell holding any integer, starting at 0, and a dump. This implementation follows the Python 2 interpreter in Dylan Renwick's repository BrainFlump, which is what TIO runs.

CommandDoes
+ -Add or take 1, with no wrapping
:Push the cell onto the dump
;Take a random value out of the dump into the cell
,Read a byte into the cell
.Print the cell as a byte
( )Loops, left out here

The README says . prints the cell modulo 127; the source prints it as it is. The loops in the source test a random value from the dump rather than the cell, and find their partner by counting, so this implementation leaves them out and stops at one. The random pop is seeded by the program and its input.

Example

The second program counts to 65, keeps it on the dump, counts on to 68, and takes the 65 back.
Expected: A

The second program counts to 65, keeps it on the dump, counts on to 68, and takes the 65 back.

Patterns it teaches

Further

Also in Jokes

Write your own in Run Convert a program from BrainFlump

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: brainflump.

Command line

shib run brainflump -e ',.,.,.' --input 'abc'
shib manual brainflump

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/brainflump.js

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