?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

Randomizers

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

+++?-[-[>+<-]]>+ (16,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

++?-[>++<-]>?+ (14,2)
>++++?-[->]<+ (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

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

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

+++++?-[>++?---<[-]]>+++ (24,2)

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

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

3/5,1;2/5,2

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

4/5,1;1/5,2

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

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

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

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

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

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

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

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

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

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

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

5/6,1;1/6,2

+++?-[-[>+<-]]>+? (17,2)
>+++?-[->]<+? (13,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

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

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

+++++++?-[-[>+<-]]>[-[-[<+>-]]<+>]<+ (36,2)
>+++++++?-[->]<[>]++?[<]> (25,3)

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

+++++++?-[-[>+<-]]>[[-]<+++?-[+[>-<-]]>++?++<]>+ (46,2)
>+++++++?-[[-]+++?---->]<++++ (27,3)

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

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

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

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

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

>>>+++++++?-[->]<[->]<[[-]++?>]<+ (31,5)

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

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

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

>>>+++++++?-[->]<[->]<[->]<+ (24,5)

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

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

4/7,1;3/7,2

>>>+++++++?-[->]<[->]<[[-]->]<++ (32,5)

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

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

5/7,1;2/7,2

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

6/7,1;1/7,2

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

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

++++++++? (9,1)

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

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

7/8,1;1/8,2

++??? (5,1)

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

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

5/8,1;3/8,2

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

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

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

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

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

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

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

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

->>>>+[<++?-]>>[<[>+<-]>>]< (27,5)

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

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

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

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

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

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

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

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

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

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

8/9,1;1/9,2

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

7/9,1;2/9,2

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

7/9,1;1/9,2;1/9,3

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

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

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

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

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

5/9,1;4/9,2

>>>+++??-[->]<[-->]<+[+?->]<+ (30,5)

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

>>>+++??-[->]<[-->]<+[+?-[+??>]]<+ (34,5)

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

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

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

>>>+++??-[->]<[-->]<+[+?->]<[+?-[>++<-]>?+<]>+ (46,5)
>>>>+++??-[->]<[-->]<+[+?->]<[+++?-[->]<+>]<+ (45,6)

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

>>>>+++??-[->]<[-->]<+[+?->]<[+++?>]<+ (38,6)

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

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


INFINITE (or arbitrary)

sqrt(e)-1,1;2-sqrt(e),2

++>>+>+[[-]<<+>[>+>+<<-]>>+[<<+>>-]<+?-]<<[<?>-]< (49,5)


Algorithms

1-(x-(x-1)*e^(1/x))*(x-1),1;(x-(x-1)*e^(1/x))*(x-1),2

(+)x>>>+>+[[-]<<+>[>+>+<<-]>>+[<<+>>-]<+?-]<<[<<?-[[-]>(+)x<]>[<+>-]>-]<<