esolang

BigBrain

Brainfuck where every cell starts at 1 and does its arithmetic with the cell next to it.

k · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello, world!

The idea

BigBrain is a brainfuck remake by k, written in Lua. The specification says it is not an extension, because too much is different. Cells start at 1, not 0, and hold any number, not a byte. There is no command to add 1. Instead + adds the cell to its right, and the same goes for minus, times, power and root. The most useful command is _, which joins the digits of two cells, so 7 and 2 make 72.

Read the story

There are two tapes under one pointer, which the specification names the processing lane and the graphics lane, and three kinds of loop.

The machine

CharDoes
+ - * /Add, subtract, multiply or divide with the next cell
^ :Raise to the power of the next cell, or take that root
_Join the digits of this cell and the next
= $Copy the next cell here; set the next cell to 1
! ?Swap with the right or the left neighbour
> < &Move right, left, or back to the first cell
# " %Take the cell's index; switch tape; copy from the other tape
[ ]Loop while the cell is not 0
{ }Loop while the cell is not 1
( )Loop while the cell differs from the next
~Flip every condition after it
. ' , ;Print a character or a number, read a character or a number

The specification leaves the number format open. Numbers print as Lua 5.1 prints them, and reading past the end of the input ends the run.

Example

The human brain Hello world.

The human brain Hello world. Seven and 2 join to 72 for the H. The rest is mostly adding and taking away the cell next door, which the program sets to 1, 2 or 4 as it needs.

The simple algorithm builds every letter by joining digits, 10 and 1 into 101 for the e. It is headed Hello, World! with a capital W, but its w is 11 joined with 9, which is 119, a small w.

Expected: Hello, world!

The cat makes the first cell 2, so it differs from the 1 beside it, and loops until it reads a character with code 1.

Expected: cat

Further

BigBrain builds on Brainfuck.

Brainfuck derivatives

Cell-based

Write your own in Run Convert a program from BigBrain

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run bigbrain -e '+(,.)' --input 'cat'
shib manual bigbrain

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/bigbrain.js

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

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