BrainF Language

Computer Science Level 3

In the Brainf*ck language, only the following eight commands are recognised:

'>' increment pointer

'<' decrement pointer

'+' increment value at pointer

'-' decrement value at pointer

'[' begin loop (continues while value at pointer is not-zero) (if value is zero then skip over code to end of loop)

']' end loop

',' read one character from input into value at pointer

'.' print value at pointer to output as a character

There are different cells, starting from 0, so the following code:


would output 123 (cell 1 has 1 value in it, cell 2 has been incremented twice so has value 2, and so forth).

Considering that each number prints out as its ASCII value, found here and considering that the following code prints 'Hello, world!' :

'++++++++++[>+++++++>++++++++++>+++>++++< <<<-]>++.>+.+++++++..+++.>>++++.<++.<+++ +++++.--------.+++.------.--------.>+.'

Because this code gives changes each address (cell) to the following values: Address 0 value 0, Address 1 value 72, Address 2 value 100, Address 3 value 33, Address 4 value 44,

then what (efficient) brainf*ck code would change each address to the following values: Address 0 Value 1, Address 1 Value 0 Address 2 Value 100


Problem Loading...

Note Loading...

Set Loading...