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
! 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