Real Brainfuck

From Esolang
Jump to navigation Jump to search

Real Brainfuck is a brainfuck variant that operates on the real-valued range {0, 1}. The tape starts with all cells set to 0.5. It also has a stack. This is a more usable version of an esolang i designed in the past.

It has the following instructions:

Instruction Explanation
< Move data pointer left on tape
> Move data pointer right on tape
0 Set current cell c to (c + 0) / 2
1 Set current cell c to (c + 1) / 2
N Set current cell c to 1 - c
[ Randomly choose between 0 and 1 with probability c. if zero jump past matching ]
] Randomly choose between 0 and 1 with probability c. if not zero jump back to matching [
^ Push cell data to stack
V Pop item from stack to current cell
& Pops top two items on the stack, multiplies them together, and pushes the result back
X Pops top two items on the stack, averages them together, and pushes the result back
, Obtains real-valued or binary input from an implementation-dependent source and sets the cell to that value
. Outputs current real value
q Outputs either 0 or 1 with probability c

Real Brainfuck 2 Variant: operates on all complex real numbers. It has support for abnormal probabilities and the following additional Instructions:

Instruction Explanation
+ c = c + 1
- c = c - 1
; c = c root of c
\ pop two items from stack, a & b, and push c: c = loga(b)
/ c = sin(c)
z c = c ^ pi
: pop two items from stack, a & b, and push c: c = a ^ b
f c = c ^^ 2 (c tetrate 2)
e set cell to transcendental number e
p set cell to transcendental number pi
! c = c! (multiplication factorial)
? c = c? (addition factorial)
$ c = c$ (exponential factorial)
{ begin ()infinite loop (finishes in finite time, hyperloop)
} end ()infinite loop (finishes in finite time, hyperloop)