?brainfuck

From Esolang
Jump to navigation Jump to search

?brainfuck is a simple derivative of brainfuck that allows it to be non-deterministic. It adds one command.

the command:

? if cell is 0 it stays that way, if the cell is positive it is set to a random number in the set {1,2,...,x} where x is the value of the cell;
if the cell is negative, it is set to a random number in set {-1,-2,...,x} where x is the value of the cell

constants

1/2,1;1/2,2

++? (3,1)

1/3,1;1/3,2;1/3,3

+++? (4,1)

2/3,1;1/3,2

>+++?-[->]<+ (12,3)

1/4,1;1/4,2;1/4,3;1/4,4

++++? (5,1)

1/2,1;1/4,2;1/4,3

>++++?-[->]<+ (13,3)

3/4,1;1/4,2

++?? (4,1)

1/5,1;1/5,2;1/5,3;1/5,4;1/5,5

+++++? (6,1)

2/5,1;1/5,2;1/5,3;1/5,4

>+++++?-[->]<+ (14,3)

2/5,1;2/5,2;1/5,3

>+++++?-[[-]++?--->]<+ (22,3)

3/5,1;1/5,2;1/5,3

>>+++++?-[->]<[->]<+ (20,4)

3/5,1;2/5,2

>+++++?-[[-]++?->]<+ (20,3)

4/5,1;1/5,2

>+++++?-[[-]->]<++ (18,3)

1/6,1;1/6,2;1/6,3;1/6,2;1/6,5;1/6,6

++++++? (6,1)

1/3,1;1/6,2;1/6,3;1/6,4;1/6,5

>++++++?-[->]<+ (15,3)

1/3,1;1/3,2;1/6,3;1/6,4

>+++?-[>]++?++[<]> (18,3)

1/2,1;1/6,2;1/6,3;1/6,4

>++?-[++?>]<+ (13,3)

1/2,1;1/3,2;1/6,3

>++?-[+++?-[->]<+>]<+ (21,3)

2/3,1;1/6,2;1/6,3

>>+++?-[->]<[+?>]<+ (18,4)

5/6,1;1/6,2

>++++++?-[[-]->]<+ (19,3)

1/7,1;1/7,2;1/7,3;1/7,4;1/7,5;1/7,6;1/7,7

+++++++? (8,1)

2/7,1;1/7,2;1/7,3;1/7,4;1/7,5;1/7,6

>+++++++?-[->]<+ (16,3)