BrainJuice

From Esolang
(Redirected from Brainjuice)
Jump to navigation Jump to search

BrainJuice is an esoteric programming language by A Monitor. It's based on Brainfuck, but has more instructions and slightly different behavior. It's official interpreter can be found here.

BrainJuice is easy to interpret however some instructions make it hard or inefficient to compile.

BrainJuice has all of the instructions of Brainfuck, plus more.

Overview

The extra instructions
Symbol Name Description
0 Nullify Sets the current cell to 0
; Set Sets the current cell to the ASCII value of the next character. Also skips the next character.
* Multiply Sets the current cell to its value times the next cell's value
/ Divide Sets the current cell to its value divided by the next cell's value using integer division
^ Power Sets the current cell to its value raised to the power of the next cell's value
% Modulo Sets the current cell to its value modulus the next cell's value
~ Logarithm Sets the current cell to its natural logarithm (as an integer)
$ Restart Makes the pointer go to 0
@ Warp Makes the pointer go to the value of the current cell. So if the value was 3 it would go to the 4th cell (pointer starts at 0)
: Number Sets the current cell to the number after this, ended with another :.
( and ) If Will only execute whats inside ONCE if the value of the current cell is greater than 0
& Index Will set the current cell to the position of the pointer
{ Swap Left Will swap the current cell with the one behind it
} Swap Right Will swap the current cell with the one after it
# Execute Will execute as a BrainJuice instruction the character who's ASCII value is the same as the current cell's value. It will run with a pointer of 0, but the same memory.
` Block Will toggle if the character who's ASCII value is the same as the current cell's value can be executed by the program or by '#.
" String This is used for printing constant text to the screen. It will print the characters between the string. \ does not do anything here though.
_ Pointer This will set the current cell to the value of the cell who's index is the same as the current one's value.
| Pipe This will set the current cell to the value of the cell who's index is the same as the value of the cell who's index is the same as the current cell's value.
\ Interpreter This will run the characters stored in the next cells until a 0 or less as a BrainJuice program. This will be ran with its own pointer, but not its own memory.

Some internal differences

BrainJuice numbers are 64-bit signed integers. This means they can be negative. BrainJuice also plays on a tape who is infinite in BOTH directions.

Examples

Hello, world!

"Hello, world!"

Cat Program

,[.,]

BrainJuice Interpreter

>,[>,]$\

Copy the last block

&-_

Truth Machine

>;0<,>[-<->]<[;1.];0.

Infinitely Recursive Segment

$;##

* The $ is only if it's not already in the 0th cell