Brainfuck

+++ +++ +++ +[>

           +++ +++ +

          >

           +++ +++ +++ +

         <++ .

>+++ ++ .

Brainfuck is easy and interesting.

We work on cells, like if you know c, cell is like ptr = unsigned char *

  • stands for increment like ++*ptr

  • stands for decrement like --*ptr

> goes one cell right like ++ptr

< goes one cell left like --ptr

. spits out output like putchar(*ptr)

, expects input. like *ptr = getchar(stdin)

[ is the start of while block test condition (for non-zero) which is like while(*ptr) {

] is the end of the block }

And everything else is comment, like the these sentences.

The above program is designed to output "Hi" and if you include these

sentenses too, it will print "Hii" and wait for some input and enter

presses till the cell becomes zero.

Isn't it cool? :)

BTW, you can run this program using an interpretor called (bf) just an apt-get away.

Comments

Comments powered by Disqus