Loop preventing brainfuck

From Esolang
Jump to navigation Jump to search

Loop preventing brainfuck is a brainfuck derivative that can be used to solve the halting problem, calculate busy beavers, and solve math problems.

Commands

Command Description
> Move the pointer to the right
< Move the pointer to the left
+ Increment the memory cell at the pointer
- Decrement the memory cell at the pointer
. Output the character signified by the cell at the pointer
, Input a character and store it in the cell at the pointer
[ Repeats the code between [ and | while the cell at the pointer is nonzero.
( Skips the structure if executing the code between ( and | will not exit
| Ends a stucture,

Unbounded integers

It is reasonable to assume that, if one does operations on infinity, it will result in the machine never halting. you cant remove any infinities either. One can however test for infinity using ([-||[ CODE |

Examples

Run CODE If cell at pointer is Zero

([| CODE |

Find 1 to the right and move to it if it exists

(<-[+<-|+|

add cell to the left to current cell if cell to the left is NOT infinity

+(>[-<+>|<|

BrainFuck busy beaver

nothing here yet

Semidecider solver

If we have a brainfuck program b we can replace all ] with | to result in a loop preventing brainfuck program with the same behavior. If we have a brainfuck program which semidecides some fact, then we can modify it to set the cell under the pointer to 1 by adding a [-|+ at the end. If we then use the skip structure, we can determine the answer of the semidecision.

Assuming a blank starting tape, this outputs the value 1 if b halts, or nul if it doesn't.

( b [-|+ | .

Solver with output

+(- b [-|| [---[--->+<|>.-------.------.-------.+++++++++++.++++++++.[-||

For best results, make b print the output.

if it b does not halt the program prints 'UNHALT'

Solving collatz conjecture

nothing here yet