Skip to main content
edited body
Source Link
pizzapants184
  • 3.5k
  • 15
  • 18
-[-[-<]>>+<]>- *32* from https://esolangs dot org/wiki/Brainfuck_constants#32
[<<++>+>-]      64 32 *0*
<<+<<<            *0* 0 0 65 32
-[+>++[++<]>]>-- *78* 65 32 from https://esolangs dot org/wiki/Brainfuck_constants#78

>>

 [>>>>[-]<<<<[>>+>>+<<<<-]<] 0 *0* 0 0 78 65 78 65 32

<<
,<,          *b* a     0 0 0 0 78 65 78 65 32
[>+<-]>      0 *b plus a=c* 0 0 0 0 78 65 78 65 32
[>+>+>>+<<<<-]>>>> 0 0 c c 0 *c* 78 65 78 65 32

--                      0 0 c c 0 *c minus 2* 78 65 78 65 32
[>.<[-]]>>.>.>+++.>.    0 0 c c 0 0   78 65 78 *68* 32    (N)AND space  print N if c ==!= 2
[<]<<[>>+<<-]>>         0 0 c 0 0 *c* 78 65 78 68 32
<+>[<[-]>[-]]<[->+<]>   0 0 c 0 0 *!c* 78 65 78 68 32 
[>.<[-]]>+.+++.         0 0 c 0 0 0  *82* 65 78 68 32     (N)OR         print N if c == 0
< <<<[>>>+<<<-]>>>      0 0 0 0 0 *c* 82 65 78 68 32
>>>>>.<<<<++++++.<      0 0 0 0 0 *c* 88 65 78 68 32      space X
-[>>>.<<<[-]]           0 0 0 0 0 *0* 88 65 78 68 32      (N)           print N if c != 1
>>>+.+++.               0 0 0 0 0 0   88 65 *82* 68 32
-[-[-<]>>+<]>- *32* from https://esolangs dot org/wiki/Brainfuck_constants#32
[<<++>+>-]      64 32 *0*
<<+<<<            *0* 0 0 65 32
-[+>++[++<]>]>-- *78* 65 32 from https://esolangs dot org/wiki/Brainfuck_constants#78

>>

 [>>>>[-]<<<<[>>+>>+<<<<-]<] 0 *0* 0 0 78 65 78 65 32

<<
,<,          *b* a     0 0 0 0 78 65 78 65 32
[>+<-]>      0 *b plus a=c* 0 0 0 0 78 65 78 65 32
[>+>+>>+<<<<-]>>>> 0 0 c c 0 *c* 78 65 78 65 32

--                      0 0 c c 0 *c minus 2* 78 65 78 65 32
[>.<[-]]>>.>.>+++.>.    0 0 c c 0 0   78 65 78 *68* 32    (N)AND space  print N if c == 2
[<]<<[>>+<<-]>>         0 0 c 0 0 *c* 78 65 78 68 32
<+>[<[-]>[-]]<[->+<]>   0 0 c 0 0 *!c* 78 65 78 68 32 
[>.<[-]]>+.+++.         0 0 c 0 0 0  *82* 65 78 68 32     (N)OR         print N if c == 0
< <<<[>>>+<<<-]>>>      0 0 0 0 0 *c* 82 65 78 68 32
>>>>>.<<<<++++++.<      0 0 0 0 0 *c* 88 65 78 68 32      space X
-[>>>.<<<[-]]           0 0 0 0 0 *0* 88 65 78 68 32      (N)           print N if c != 1
>>>+.+++.               0 0 0 0 0 0   88 65 *82* 68 32
-[-[-<]>>+<]>- *32* from https://esolangs dot org/wiki/Brainfuck_constants#32
[<<++>+>-]      64 32 *0*
<<+<<<            *0* 0 0 65 32
-[+>++[++<]>]>-- *78* 65 32 from https://esolangs dot org/wiki/Brainfuck_constants#78

>>

 [>>>>[-]<<<<[>>+>>+<<<<-]<] 0 *0* 0 0 78 65 78 65 32

<<
,<,          *b* a     0 0 0 0 78 65 78 65 32
[>+<-]>      0 *b plus a=c* 0 0 0 0 78 65 78 65 32
[>+>+>>+<<<<-]>>>> 0 0 c c 0 *c* 78 65 78 65 32

--                      0 0 c c 0 *c minus 2* 78 65 78 65 32
[>.<[-]]>>.>.>+++.>.    0 0 c c 0 0   78 65 78 *68* 32    (N)AND space  print N if c != 2
[<]<<[>>+<<-]>>         0 0 c 0 0 *c* 78 65 78 68 32
<+>[<[-]>[-]]<[->+<]>   0 0 c 0 0 *!c* 78 65 78 68 32 
[>.<[-]]>+.+++.         0 0 c 0 0 0  *82* 65 78 68 32     (N)OR         print N if c == 0
< <<<[>>>+<<<-]>>>      0 0 0 0 0 *c* 82 65 78 68 32
>>>>>.<<<<++++++.<      0 0 0 0 0 *c* 88 65 78 68 32      space X
-[>>>.<<<[-]]           0 0 0 0 0 *0* 88 65 78 68 32      (N)           print N if c != 1
>>>+.+++.               0 0 0 0 0 0   88 65 *82* 68 32
Source Link
pizzapants184
  • 3.5k
  • 15
  • 18

brainfuck, 234 bytes

>-[-[-<]>>+<]>-[<<++>+>-]<<+<<<-[+>++[++<]>]>-->>[>>>>[-]<<<<[>>+>>+<<<<-]<]<<,<,[>+<-]>[>+>+>>+<<<<-]>>>>--[>.<[-]]>>.>.>+++.>.[<]<<[>>+<<-]>+>[<[-]>[-]]<[->+<]>[>.<[-]]>+.+++.<<<<[>>>+<<<-]>>>>>>>>.<<<<++++++.<-[>>>.<<<[-]]>>>+.+++.

Try it online!

Takes input as two bytes (0 or 1) on stdin, outputs space-separated to stdout without trailing whitespace.

The TIO link has the 11 test case because I couldn't figure out how to type the null character into a web browser, but if you delete the second input character it will do the same thing as the 10 test-case, and if you delete both it will be the same as the 00 test-case.

Here's my annotated version (the two input bytes are b and a, their sum is c):

-[-[-<]>>+<]>- *32* from https://esolangs dot org/wiki/Brainfuck_constants#32
[<<++>+>-]      64 32 *0*
<<+<<<            *0* 0 0 65 32
-[+>++[++<]>]>-- *78* 65 32 from https://esolangs dot org/wiki/Brainfuck_constants#78

>>

 [>>>>[-]<<<<[>>+>>+<<<<-]<] 0 *0* 0 0 78 65 78 65 32

<<
,<,          *b* a     0 0 0 0 78 65 78 65 32
[>+<-]>      0 *b plus a=c* 0 0 0 0 78 65 78 65 32
[>+>+>>+<<<<-]>>>> 0 0 c c 0 *c* 78 65 78 65 32

--                      0 0 c c 0 *c minus 2* 78 65 78 65 32
[>.<[-]]>>.>.>+++.>.    0 0 c c 0 0   78 65 78 *68* 32    (N)AND space  print N if c == 2
[<]<<[>>+<<-]>>         0 0 c 0 0 *c* 78 65 78 68 32
<+>[<[-]>[-]]<[->+<]>   0 0 c 0 0 *!c* 78 65 78 68 32 
[>.<[-]]>+.+++.         0 0 c 0 0 0  *82* 65 78 68 32     (N)OR         print N if c == 0
< <<<[>>>+<<<-]>>>      0 0 0 0 0 *c* 82 65 78 68 32
>>>>>.<<<<++++++.<      0 0 0 0 0 *c* 88 65 78 68 32      space X
-[>>>.<<<[-]]           0 0 0 0 0 *0* 88 65 78 68 32      (N)           print N if c != 1
>>>+.+++.               0 0 0 0 0 0   88 65 *82* 68 32