alan2here alan2here - 1 year ago 71
Brainfuck Question

Brainfuck with 1bit memory cells?

Would an implementation of the programming language Brainfuck, still be turing complete if its memory cells were 1bit in capacity, instead of the usual 8bit?

The + and - instructions become identical, however this need not be a problem.

I see no issue with, for example 4bit memory cells, but I cannot work out if this scales all the way to single bit values.

Answer Source

Yes, the resulting language would still be Turing-complete. In fact, several such languages exist. One of them is Boolfuck. It does exactly what you suggest: have each cell be a single bit and get rid of -, because it's redundant. It also uses ; instead . for output. The official website contains a reduction from Brainfuck to Boolfuck which proves Boolfuck's Turing-completeness. I'm reiterating the reduction here to make the answer self-contained:

Brain.  Bool.
+       >[>]+<[+<]>>>>>>>>>[+]<<<<<<<<<
-       >>>>>>>>>+<<<<<<<<+[>+]<[<]>>>>>>>>>[+]<<<<<<<<<
<       <<<<<<<<<
>       >>>>>>>>>
,       >,>,>,>,>,>,>,>,<<<<<<<<
.       >;>;>;>;>;>;>;>;<<<<<<<<
[       >>>>>>>>>+<<<<<<<<+[>+]<[<]>>>>>>>>>[+<<<<<<<<[>]+<[+<]
]       >>>>>>>>>+<<<<<<<<+[>+]<[<]>>>>>>>>>]<[+<]

Other bit-based Brainfuck-derivatives include Smallfuck and BitChanger. This article may also be of interest to you, which goes through several steps of minimising the Brainfuck language by removing redundancy (including using bits instead of bytes).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download